mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 15:37:17 +02:00
Fix error in MonitorHandler recovering a saved Session across a reload. This probably affected the TickerHandler as well. Add a new hook to the server object that gets called once the portal has synced, and run the monitorhandler/tickerhandler restores there. Also some changes to the serialization of Sessions. Resolves #1164.
This commit is contained in:
parent
b46bc9b2aa
commit
052e1845a2
6 changed files with 70 additions and 34 deletions
|
|
@ -71,11 +71,16 @@ class MonitorHandler(object):
|
|||
restored_monitors = dbunserialize(restored_monitors)
|
||||
for (obj, fieldname, idstring, path, persistent, kwargs) in restored_monitors:
|
||||
try:
|
||||
if not persistent and not server_reload:
|
||||
if not server_reload and not persistent:
|
||||
# this monitor will not be restarted
|
||||
continue
|
||||
if "session" in kwargs and not kwargs["session"]:
|
||||
# the session was removed because it no longer
|
||||
# exists. Don't restart the monitor.
|
||||
continue
|
||||
modname, varname = path.rsplit(".", 1)
|
||||
callback = variable_from_module(modname, varname)
|
||||
|
||||
if obj and hasattr(obj, fieldname):
|
||||
self.monitors[obj][fieldname][idstring] = (callback, persistent, kwargs)
|
||||
except Exception:
|
||||
|
|
@ -116,6 +121,13 @@ class MonitorHandler(object):
|
|||
persistent (bool, optional): If False, the monitor will survive
|
||||
a server reload but not a cold restart. This is default.
|
||||
|
||||
Kwargs:
|
||||
session (Session): If this keyword is given, the monitorhandler will
|
||||
correctly analyze it and remove the monitor if after a reload/reboot
|
||||
the session is no longer valid.
|
||||
any (any): Any other kwargs are passed on to the callback. Remember that
|
||||
all kwargs must be possible to pickle!
|
||||
|
||||
"""
|
||||
if not fieldname.startswith("db_") or not hasattr(obj, fieldname):
|
||||
# an Attribute - we track its db_value field
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue