Added CONN_MAX_AGE setting to 7hrs to avoid 'database has gone away' errors with MySQL default settings. Resolves #619.

This commit is contained in:
Griatch 2015-03-06 21:21:07 +01:00
parent a6c2910e93
commit 04a1d9c238
3 changed files with 11 additions and 1 deletions

View file

@ -514,7 +514,7 @@ class DefaultObject(ObjectDB):
All extra kwargs will be passed on to the protocol.
"""
text = to_str(text, force_string=True) if text else ""
text = to_str(text, force_string=True) if text != None else ""
if from_obj:
# call hook
try:

View file

@ -117,6 +117,11 @@ def _server_maintenance():
# validate channels off-sync with scripts
print "maintenance: validate channels..."
evennia.CHANNEL_HANDLER.update()
## 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

View file

@ -197,6 +197,11 @@ DATABASES = {
'HOST': '',
'PORT': ''
}}
# How long the django-database connection should be kept open, in seconds.
# If you get errors about the database having gone away after long idle
# periods, shorten this value (e.g. MySQL defaults to a timeout of 8 hrs)
CONN_MAX_AGE = 3600 * 7
######################################################################
# Evennia pluggable modules