Skip to content

Commit 063920c

Browse files
refactor: recycle db connection to avoid "the connection is closed" exception.
1 parent 3d08263 commit 063920c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/maxkb/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ def get_db_setting(self) -> dict:
5959
"USER": self.get('DB_USER'),
6060
"PASSWORD": self.get('DB_PASSWORD'),
6161
"ENGINE": self.get('DB_ENGINE'),
62+
"CONN_MAX_AGE": 0,
6263
"POOL_OPTIONS": {
6364
"POOL_SIZE": 20,
64-
"MAX_OVERFLOW": int(self.get('DB_MAX_OVERFLOW'))
65+
"MAX_OVERFLOW": int(self.get('DB_MAX_OVERFLOW')),
66+
'RECYCLE': 1800,
67+
'TIMEOUT': 30
6568
}
6669
}
6770

0 commit comments

Comments
 (0)