[password-resets] SQLAlchemy connections tuning for liveness checks / connection recycling (https://medium.com/@heyjcm



commit aefd420ec87ab051289670cbb00309a61acaa3d7
Author: Andrea Veri <averi redhat com>
Date:   Thu Nov 12 23:29:45 2020 +0100

    SQLAlchemy connections tuning for liveness checks / connection recycling 
(https://medium.com/@heyjcmc/controlling-the-flask-sqlalchemy-engine-a0f8fae15b47)

 db/base.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/db/base.py b/db/base.py
index ab4bf49..429b519 100644
--- a/db/base.py
+++ b/db/base.py
@@ -17,7 +17,9 @@ DATABASE = 'mysql+pymysql://%s:%s@%s:%s/%s?charset=utf8' % (
 ENGINE = create_engine(
     DATABASE,
     encoding="utf-8",
-    echo=True
+    echo=True,
+    pool_pre_ping=True,
+    pool_recycle=3600,
 )
 
 Session = scoped_session(


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]