Created
April 3, 2018 19:23
-
-
Save harlowja/9c8dcfeb4697b11781126db1fab19a4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e482cee76b9a4e8e0cb865bc2f9c7bb14fe29cae Mon Sep 17 00:00:00 2001 | |
From: David Moreau Simard <[email protected]> | |
Date: Thu, 30 Nov 2017 18:34:19 -0500 | |
Subject: [PATCH] Add support for configuring sqlalchemy pool size, timeout and | |
recycle | |
These are especially useful when using remote database servers. | |
We need to be able to tweak when timeouts and recycling are occuring | |
on the client side in order to prevent server-side timeouts to be | |
happening. | |
Change-Id: I7ced5ad644da212c80d9f3fcf0e3e1bad44e2e41 | |
--- | |
ara/config.py | 15 ++++++++++++++- | |
1 file changed, 14 insertions(+), 1 deletion(-) | |
diff --git a/ara/config.py b/ara/config.py | |
index e8d7587..880731e 100644 | |
--- a/ara/config.py | |
+++ b/ara/config.py | |
@@ -87,7 +87,11 @@ DEFAULTS = { | |
'ARA_PORT': '9191', | |
'ARA_RESULT_PER_PAGE': 25, | |
'ARA_SQL_DEBUG': False, | |
- 'ARA_TMP_DIR': os.path.expanduser('~/.ansible/tmp') | |
+ 'ARA_TMP_DIR': os.path.expanduser('~/.ansible/tmp'), | |
+ # Let flask-sqlalchemy handle these defaults | |
+ 'SQLALCHEMY_POOL_SIZE': None, | |
+ 'SQLALCHEMY_POOL_TIMEOUT': None, | |
+ 'SQLALCHEMY_POOL_RECYCLE': None | |
} | |
# Bootstrap Ansible configuration | |
@@ -156,6 +160,15 @@ SQLALCHEMY_ECHO = _ara_config(config, 'sqldebug', | |
'ARA_SQL_DEBUG', | |
value_type='boolean') | |
SQLALCHEMY_TRACK_MODIFICATIONS = False | |
+SQLALCHEMY_POOL_SIZE = _ara_config(config, 'sqlalchemy_pool_size', | |
+ 'SQLALCHEMY_POOL_SIZE', | |
+ value_type='integer') | |
+SQLALCHEMY_POOL_TIMEOUT = _ara_config(config, 'sqlalchemy_pool_timeout', | |
+ 'SQLALCHEMY_POOL_TIMEOUT', | |
+ value_type='integer') | |
+SQLALCHEMY_POOL_RECYCLE = _ara_config(config, 'sqlalchemy_pool_recycle', | |
+ 'SQLALCHEMY_POOL_RECYCLE', | |
+ value_type='integer') | |
INSTALL_PATH = os.path.dirname(os.path.realpath(__file__)) | |
DB_MIGRATIONS = os.path.join(INSTALL_PATH, 'db') | |
-- | |
2.10.1 (Apple Git-78) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment