Make sure at_server_reload is called from non-repeating scripts. Resolve #3139.

This commit is contained in:
Griatch 2023-08-06 16:32:52 +02:00
parent 22a20c9094
commit c113cabeba

View file

@ -27,22 +27,17 @@ import evennia
evennia._init()
from evennia.server.sessionhandler import SESSIONS
from django.conf import settings
from django.db import connection
from django.db.utils import OperationalError
from django.utils.translation import gettext as _
from evennia.accounts.models import AccountDB
from evennia.scripts.models import ScriptDB
from evennia.server.models import ServerConfig
from evennia.server.sessionhandler import SESSIONS
from evennia.utils import logger
from evennia.utils.utils import get_evennia_version, make_iter, mod_import
_SA = object.__setattr__
# a file with a flag telling the server to restart after shutdown or not.
@ -490,9 +485,9 @@ class Evennia:
yield [o.at_server_reload() for o in ObjectDB.get_all_cached_instances()]
yield [p.at_server_reload() for p in AccountDB.get_all_cached_instances()]
yield [
(s._pause_task(auto_pause=True), s.at_server_reload())
(s._pause_task(auto_pause=True) if s.is_active else None, s.at_server_reload())
for s in ScriptDB.get_all_cached_instances()
if s.id and s.is_active
if s.id
]
yield self.sessions.all_sessions_portal_sync()
self.at_server_reload_stop()
@ -705,7 +700,6 @@ if "--nodaemon" not in sys.argv and "test" not in sys.argv:
EVENNIA = Evennia(application)
if AMP_ENABLED:
# The AMP protocol handles the communication between
# the portal and the mud server. Only reason to ever deactivate
# it would be during testing and debugging.
@ -724,7 +718,6 @@ if AMP_ENABLED:
EVENNIA.services.addService(amp_service)
if WEBSERVER_ENABLED:
# Start a django-compatible webserver.
from evennia.server.webserver import (