mirror of
https://github.com/evennia/evennia.git
synced 2026-03-17 05:16:31 +01:00
Re-add regular database-connection drops to address MySQL timeouts. Resolves #1376.
This commit is contained in:
parent
9e42277fbb
commit
dd457ef695
1 changed files with 5 additions and 5 deletions
|
|
@ -127,6 +127,11 @@ def _server_maintenance():
|
|||
if _MAINTENANCE_COUNT % 3700 == 0:
|
||||
# validate channels off-sync with scripts
|
||||
evennia.CHANNEL_HANDLER.update()
|
||||
if _MAINTENANCE_COUNT % (3600 * 7) == 0:
|
||||
# drop database connection every 7 hrs to avoid default timeouts on MySQL
|
||||
# (see https://github.com/evennia/evennia/issues/1376)
|
||||
print("Dropping database connection!")
|
||||
connection.close()
|
||||
|
||||
# handle idle timeouts
|
||||
if _IDLE_TIMEOUT > 0:
|
||||
|
|
@ -137,11 +142,6 @@ def _server_maintenance():
|
|||
session.account.access(session.account, "noidletimeout", default=False):
|
||||
SESSIONS.disconnect(session, reason=reason)
|
||||
|
||||
# Commenting this out, it is probably not needed
|
||||
# with CONN_MAX_AGE set. Keeping it as a reminder
|
||||
# if database-gone-away errors appears again /Griatch
|
||||
# if _MAINTENANCE_COUNT % 18000 == 0:
|
||||
# connection.close()
|
||||
maintenance_task = LoopingCall(_server_maintenance)
|
||||
maintenance_task.start(60, now=True) # call every minute
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue