From 01d82939e02da51d05a5f22beec883262b02aa0b Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:47:10 +1300 Subject: [PATCH] db pool config options --- app/__init__.py | 2 +- config.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/__init__.py b/app/__init__.py index 4887c1f6..ba44ceed 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -32,7 +32,7 @@ def get_locale(): return 'en' -db = SQLAlchemy(session_options={"autoflush": False}) # engine_options={'pool_size': 5, 'max_overflow': 10} # session_options={"autoflush": False} +db = SQLAlchemy(session_options={"autoflush": False}, engine_options={'pool_size': Config.DB_POOL_SIZE, 'max_overflow': Config.DB_MAX_OVERFLOW}) # engine_options={'pool_size': 5, 'max_overflow': 10} # session_options={"autoflush": False} migrate = Migrate() login = LoginManager() login.login_view = 'auth.login' diff --git a/config.py b/config.py index 504663f2..c26bfe15 100644 --- a/config.py +++ b/config.py @@ -58,3 +58,6 @@ class Config(object): SPICY_UNDER_60 = float(os.environ.get('SPICY_UNDER_60', 1.0)) IPINFO_TOKEN = os.environ.get('IPINFO_TOKEN') or '' + + DB_POOL_SIZE = os.environ.get('DB_POOL_SIZE') or 10 + DB_MAX_OVERFLOW = os.environ.get('DB_MAX_OVERFLOW') or 30