diff --git a/docs/docs/core/settings.mdx b/docs/docs/core/settings.mdx index 4f1ee95e4..6c76ddbeb 100644 --- a/docs/docs/core/settings.mdx +++ b/docs/docs/core/settings.mdx @@ -96,11 +96,11 @@ If not set, all flows are in a default unnamed namespace. ::: -* `max_connections` (type: `int`, default: `64`): The maximum number of connections to keep in the pool. +* `max_connections` (type: `int`, default: `25`): The maximum number of connections to keep in the pool. *Environment variable* for `Settings.database.max_connections`: `COCOINDEX_DATABASE_MAX_CONNECTIONS` -* `min_connections` (type: `int`, default: `16`): The minimum number of connections to keep in the pool. +* `min_connections` (type: `int`, default: `5`): The minimum number of connections to keep in the pool. *Environment variable* for `Settings.database.min_connections`: `COCOINDEX_DATABASE_MIN_CONNECTIONS` @@ -134,7 +134,7 @@ This is the list of environment variables, each of which has a corresponding fie | `COCOINDEX_DATABASE_URL` | `database.url` | Yes | | `COCOINDEX_DATABASE_USER` | `database.user` | No | | `COCOINDEX_DATABASE_PASSWORD` | `database.password` | No | -| `COCOINDEX_DATABASE_MAX_CONNECTIONS` | `database.max_connections` | No (default: `64`) | -| `COCOINDEX_DATABASE_MIN_CONNECTIONS` | `database.min_connections` | No (default: `16`) | +| `COCOINDEX_DATABASE_MAX_CONNECTIONS` | `database.max_connections` | No (default: `25`) | +| `COCOINDEX_DATABASE_MIN_CONNECTIONS` | `database.min_connections` | No (default: `5`) | | `COCOINDEX_SOURCE_MAX_INFLIGHT_ROWS` | `global_execution_options.source_max_inflight_rows` | No (default: `1024`) | | `COCOINDEX_SOURCE_MAX_INFLIGHT_BYTES` | `global_execution_options.source_max_inflight_bytes` | No | diff --git a/python/cocoindex/setting.py b/python/cocoindex/setting.py index dc59c7fab..95e8c682d 100644 --- a/python/cocoindex/setting.py +++ b/python/cocoindex/setting.py @@ -44,8 +44,8 @@ class DatabaseConnectionSpec: url: str user: str | None = None password: str | None = None - max_connections: int = 64 - min_connections: int = 16 + max_connections: int = 25 + min_connections: int = 5 @dataclass diff --git a/src/lib_context.rs b/src/lib_context.rs index 26c70e9b7..4899c01d4 100644 --- a/src/lib_context.rs +++ b/src/lib_context.rs @@ -196,9 +196,9 @@ impl DbPools { let pool_options = PgPoolOptions::new() .max_connections(conn_spec.max_connections) .min_connections(conn_spec.min_connections) - .acquire_timeout(Duration::from_secs(5 * 60)) - .idle_timeout(Duration::from_secs(10 * 60)) - .max_lifetime(Duration::from_secs(60 * 60)); + .acquire_slow_level(log::LevelFilter::Info) + .acquire_slow_threshold(Duration::from_secs(10)) + .acquire_timeout(Duration::from_secs(5 * 60)); let pool = pool_options .connect_with(pg_options) .await