From dc19e644a6ca95458931b616e1461c6f1e811339 Mon Sep 17 00:00:00 2001 From: Athanasios Voutsadakis Date: Wed, 21 Feb 2018 15:44:03 +0000 Subject: [PATCH 1/2] Increase DB connection pool size to 10 This is to address some errors we saw yesterday such as: `sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30` Related flask-sqlalchemy docs: http://flask-sqlalchemy.pocoo.org/2.3/config/#configuration-keys --- app/config.py | 1 + manifest-api-base.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/config.py b/app/config.py index 3cbe9130c..ab999945f 100644 --- a/app/config.py +++ b/app/config.py @@ -127,6 +127,7 @@ class Config(object): SQLALCHEMY_COMMIT_ON_TEARDOWN = False SQLALCHEMY_RECORD_QUERIES = True SQLALCHEMY_TRACK_MODIFICATIONS = True + SQLALCHEMY_POOL_SIZE = os.environ.get('SQLALCHEMY_POOL_SIZE', 5) SQLALCHEMY_POOL_TIMEOUT = 30 SQLALCHEMY_POOL_RECYCLE = 300 PAGE_SIZE = 50 diff --git a/manifest-api-base.yml b/manifest-api-base.yml index 025459ef3..e8197575f 100644 --- a/manifest-api-base.yml +++ b/manifest-api-base.yml @@ -9,6 +9,7 @@ env: CW_APP_NAME: api # required by cf run-task FLASK_APP: application.py + SQLALCHEMY_POOL_SIZE: 10 # Credentials variables ADMIN_BASE_URL: null From c61ed043b3d96d8d5098cd95ebededae5facb3aa Mon Sep 17 00:00:00 2001 From: Athanasios Voutsadakis Date: Thu, 22 Feb 2018 10:27:02 +0000 Subject: [PATCH 2/2] Ensure pool size is an integer --- app/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config.py b/app/config.py index ab999945f..b49411164 100644 --- a/app/config.py +++ b/app/config.py @@ -127,7 +127,7 @@ class Config(object): SQLALCHEMY_COMMIT_ON_TEARDOWN = False SQLALCHEMY_RECORD_QUERIES = True SQLALCHEMY_TRACK_MODIFICATIONS = True - SQLALCHEMY_POOL_SIZE = os.environ.get('SQLALCHEMY_POOL_SIZE', 5) + SQLALCHEMY_POOL_SIZE = int(os.environ.get('SQLALCHEMY_POOL_SIZE', 5)) SQLALCHEMY_POOL_TIMEOUT = 30 SQLALCHEMY_POOL_RECYCLE = 300 PAGE_SIZE = 50