From 063920ce599501722baedab491d5d8303055b7a3 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Wed, 23 Jul 2025 16:28:38 +0800 Subject: [PATCH] refactor: recycle db connection to avoid "the connection is closed" exception. --- apps/maxkb/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/maxkb/conf.py b/apps/maxkb/conf.py index d1714eb68..068476854 100644 --- a/apps/maxkb/conf.py +++ b/apps/maxkb/conf.py @@ -59,9 +59,12 @@ class Config(dict): "USER": self.get('DB_USER'), "PASSWORD": self.get('DB_PASSWORD'), "ENGINE": self.get('DB_ENGINE'), + "CONN_MAX_AGE": 0, "POOL_OPTIONS": { "POOL_SIZE": 20, - "MAX_OVERFLOW": int(self.get('DB_MAX_OVERFLOW')) + "MAX_OVERFLOW": int(self.get('DB_MAX_OVERFLOW')), + 'RECYCLE': 1800, + 'TIMEOUT': 30 } }