Resolve duplicate script execution for global script. Make paused script fire at_server_reload. Resolve #1911.

This commit is contained in:
Griatch 2019-09-05 23:54:07 +02:00
parent ad2e0ce0be
commit 7d8d3216a9
2 changed files with 8 additions and 4 deletions

View file

@ -163,7 +163,8 @@ class ScriptBase(with_metaclass(TypeclassBase, ScriptDB)):
Start task runner.
"""
if self.ndb._task:
return
self.ndb._task = ExtendedLoopingCall(self._step_task)
if self.db._paused_time:
@ -429,7 +430,8 @@ class DefaultScript(ScriptBase):
"""
if self.is_active and not force_restart:
# The script is already running, but make sure we have a _task if this is after a cache flush
# The script is already running, but make sure we have a _task if
# this is after a cache flush
if not self.ndb._task and self.db_interval >= 0:
self.ndb._task = ExtendedLoopingCall(self._step_task)
try:
@ -440,7 +442,9 @@ class DefaultScript(ScriptBase):
now = not self.db_start_delay
start_delay = None
callcount = 0
self.ndb._task.start(self.db_interval, now=now, start_delay=start_delay, count_start=callcount)
self.ndb._task.start(self.db_interval, now=now,
start_delay=start_delay,
count_start=callcount)
return 0
obj = self.obj

View file

@ -363,7 +363,7 @@ class Evennia(object):
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(manual_pause=False), s.at_server_reload())
for s in ScriptDB.get_all_cached_instances() if s.is_active]
for s in ScriptDB.get_all_cached_instances() if s.is_active or s.attributes.has("_manual_pause")]
yield self.sessions.all_sessions_portal_sync()
self.at_server_reload_stop()
# only save monitor state on reload, not on shutdown/reset