diff --git a/.env.test b/.env.test index 9332e19..ce7bc67 100644 --- a/.env.test +++ b/.env.test @@ -3,6 +3,7 @@ POSTGRES_DATABASE_PASSWORD="" POSTGRES_DATABASE_NAME="farnsworth_test" POSTGRES_MASTER_SERVICE_HOST="postgres" POSTGRES_MASTER_SERVICE_PORT=5432 +POSTGRES_MASTER_CONNECTIONS=2 # POSTGRES_USE_SLAVES=true # POSTGRES_SLAVE_SERVICE_HOST="localhost" # POSTGRES_SLAVE_SERVICE_PORT=5432 diff --git a/farnsworth/config.py b/farnsworth/config.py index 909231f..e2c455d 100644 --- a/farnsworth/config.py +++ b/farnsworth/config.py @@ -24,7 +24,7 @@ class RetryPooledPostgresqlExtDatabase(PooledPostgresqlExtDatabase, RetryOperati register_hstore=False, autocommit=True, autorollback=True, - max_connections=20, + max_connections=os.environ.get('POSTGRES_MASTER_CONNECTIONS', 2), stale_timeout=60 ) @@ -37,7 +37,7 @@ class RetryPooledPostgresqlExtDatabase(PooledPostgresqlExtDatabase, RetryOperati host=os.environ['POSTGRES_SLAVE_SERVICE_HOST'], port=os.environ['POSTGRES_SLAVE_SERVICE_PORT'], register_hstore=False, - max_connections=40, + max_connections=os.environ.get('POSTGRES_SLAVE_CONNECTIONS', 2), stale_timeout=60 ) else: