Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>tags/1.9.0
| @@ -76,6 +76,7 @@ DB_HOST=localhost | |||
| DB_PORT=5432 | |||
| DB_DATABASE=dify | |||
| SQLALCHEMY_POOL_PRE_PING=true | |||
| SQLALCHEMY_POOL_TIMEOUT=30 | |||
| # Storage configuration | |||
| # use for store upload files, private keys... | |||
| @@ -187,6 +187,11 @@ class DatabaseConfig(BaseSettings): | |||
| default=False, | |||
| ) | |||
| SQLALCHEMY_POOL_TIMEOUT: NonNegativeInt = Field( | |||
| description="Number of seconds to wait for a connection from the pool before raising a timeout error.", | |||
| default=30, | |||
| ) | |||
| RETRIEVAL_SERVICE_EXECUTORS: NonNegativeInt = Field( | |||
| description="Number of processes for the retrieval service, default to CPU cores.", | |||
| default=os.cpu_count() or 1, | |||
| @@ -216,6 +221,7 @@ class DatabaseConfig(BaseSettings): | |||
| "connect_args": connect_args, | |||
| "pool_use_lifo": self.SQLALCHEMY_POOL_USE_LIFO, | |||
| "pool_reset_on_return": None, | |||
| "pool_timeout": self.SQLALCHEMY_POOL_TIMEOUT, | |||
| } | |||
| @@ -91,6 +91,7 @@ def test_flask_configs(monkeypatch: pytest.MonkeyPatch): | |||
| "pool_size": 30, | |||
| "pool_use_lifo": False, | |||
| "pool_reset_on_return": None, | |||
| "pool_timeout": 30, | |||
| } | |||
| assert config["CONSOLE_WEB_URL"] == "https://example.com" | |||
| @@ -225,6 +225,9 @@ SQLALCHEMY_ECHO=false | |||
| SQLALCHEMY_POOL_PRE_PING=false | |||
| # Whether to enable the Last in first out option or use default FIFO queue if is false | |||
| SQLALCHEMY_POOL_USE_LIFO=false | |||
| # Number of seconds to wait for a connection from the pool before raising a timeout error. | |||
| # Default is 30 | |||
| SQLALCHEMY_POOL_TIMEOUT=30 | |||
| # Maximum number of connections to the database | |||
| # Default is 100 | |||
| @@ -62,6 +62,7 @@ x-shared-env: &shared-api-worker-env | |||
| SQLALCHEMY_ECHO: ${SQLALCHEMY_ECHO:-false} | |||
| SQLALCHEMY_POOL_PRE_PING: ${SQLALCHEMY_POOL_PRE_PING:-false} | |||
| SQLALCHEMY_POOL_USE_LIFO: ${SQLALCHEMY_POOL_USE_LIFO:-false} | |||
| SQLALCHEMY_POOL_TIMEOUT: ${SQLALCHEMY_POOL_TIMEOUT:-30} | |||
| POSTGRES_MAX_CONNECTIONS: ${POSTGRES_MAX_CONNECTIONS:-100} | |||
| POSTGRES_SHARED_BUFFERS: ${POSTGRES_SHARED_BUFFERS:-128MB} | |||
| POSTGRES_WORK_MEM: ${POSTGRES_WORK_MEM:-4MB} | |||