From 773ec630b4149928d9126a520a4822d86350c31b Mon Sep 17 00:00:00 2001 From: Stefan de Kooter Date: Wed, 6 Nov 2019 10:24:15 +0100 Subject: [PATCH] Add CONN_MAX_AGE to database connection settings Defaulting to 300 seconds for the database connection to avoid new connection setup roundtrip on consecutive requests --- configuration/configuration.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configuration/configuration.py b/configuration/configuration.py index 14c5d83..bf941a4 100644 --- a/configuration/configuration.py +++ b/configuration/configuration.py @@ -37,6 +37,8 @@ DATABASE = { # PostgreSQL password 'HOST': os.environ.get('DB_HOST', 'localhost'), # Database server 'PORT': os.environ.get('DB_PORT', ''), # Database port (leave blank for default) + 'CONN_MAX_AGE': int(os.environ.get('DB_CONN_MAX_AGE', '300')), + # Database connection persistence } # This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file.