Merge changes from master

This commit is contained in:
Griatch 2020-07-15 18:07:45 +02:00
commit 94cf728081
24 changed files with 324 additions and 244 deletions

View file

@ -13,6 +13,7 @@ import time
from os.path import dirname, abspath
from twisted.application import internet, service
from twisted.internet.task import LoopingCall
from twisted.internet import protocol, reactor
from twisted.python.log import ILogObserver
@ -20,6 +21,7 @@ import django
django.setup()
from django.conf import settings
from django.db import connection
import evennia
@ -101,10 +103,29 @@ except ImportError:
WEB_PLUGINS_MODULE = None
INFO_DICT["errors"] = (
"WARNING: settings.WEB_PLUGINS_MODULE not found - "
"copy 'evennia/game_template/server/conf/web_plugins.py to mygame/server/conf."
"copy 'evennia/game_template/server/conf/web_plugins.py to "
"mygame/server/conf."
)
_MAINTENANCE_COUNT = 0
def _portal_maintenance():
"""
Repeated maintenance tasks for the portal.
"""
global _MAINTENANCE_COUNT
_MAINTENANCE_COUNT += 1
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)
connection.close()
# -------------------------------------------------------------
# Portal Service object
# -------------------------------------------------------------
@ -143,6 +164,9 @@ class Portal(object):
self.start_time = time.time()
self.maintenance_task = LoopingCall(_portal_maintenance)
self.maintenance_task.start(60, now=True) # call every minute
# in non-interactive portal mode, this gets overwritten by
# cmdline sent by the evennia launcher
self.server_twistd_cmd = self._get_backup_server_twistd_cmd()

View file

@ -249,6 +249,8 @@ class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION_CLASS):
return
else:
return
# just to be sure
text = to_str(text)
flags = self.protocol_flags