From a52c039fcd391a1b63d1c77fcb153f490dc79c44 Mon Sep 17 00:00:00 2001 From: Kevin Borgolte Date: Fri, 22 Jul 2016 19:31:20 -0700 Subject: [PATCH] Add POSTGRES_MASTER_CONNECTIONS --- .env.test | 1 + farnsworth/config.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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: