Make TaskHandler properly handle missing attribute on server reload. Resolve #3620
This commit is contained in:
parent
2b95446dd0
commit
c476121a6c
2 changed files with 12 additions and 5 deletions
|
|
@ -36,6 +36,8 @@ did not add it to the handler's object (Griatch)
|
||||||
respected (Griatch)
|
respected (Griatch)
|
||||||
- [Fix][issue3624]: Setting tags with integer names caused errors on postgres (Griatch)
|
- [Fix][issue3624]: Setting tags with integer names caused errors on postgres (Griatch)
|
||||||
- [Fix][issue3615]: Using `print()` in `py` caused an infinite loop (Griatch)
|
- [Fix][issue3615]: Using `print()` in `py` caused an infinite loop (Griatch)
|
||||||
|
- [Fix][issue3620]: Better handle TaskHandler running against an attribute that
|
||||||
|
was removed since last reload (Griatch)
|
||||||
- [Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch)
|
- [Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch)
|
||||||
- Docs: Tutorial fixes (Griatch, aMiss-aWry, feyrkh)
|
- Docs: Tutorial fixes (Griatch, aMiss-aWry, feyrkh)
|
||||||
|
|
||||||
|
|
@ -46,6 +48,7 @@ did not add it to the handler's object (Griatch)
|
||||||
[issue3612]: https://github.com/evennia/evennia/issues/3612
|
[issue3612]: https://github.com/evennia/evennia/issues/3612
|
||||||
[issue3624]: https://github.com/evennia/evennia/issues/3624
|
[issue3624]: https://github.com/evennia/evennia/issues/3624
|
||||||
[issue3615]: https://github.com/evennia/evennia/issues/3615
|
[issue3615]: https://github.com/evennia/evennia/issues/3615
|
||||||
|
[issue3620]: https://github.com/evennia/evennia/issues/3620
|
||||||
[pull3595]: https://github.com/evennia/evennia/pull/3595
|
[pull3595]: https://github.com/evennia/evennia/pull/3595
|
||||||
[pull3533]: https://github.com/evennia/evennia/pull/3533
|
[pull3533]: https://github.com/evennia/evennia/pull/3533
|
||||||
[pull3594]: https://github.com/evennia/evennia/pull/3594
|
[pull3594]: https://github.com/evennia/evennia/pull/3594
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,12 @@ Module containing the task handler for Evennia deferred tasks, persistent or not
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from pickle import PickleError
|
from pickle import PickleError
|
||||||
|
|
||||||
from twisted.internet import reactor
|
|
||||||
from twisted.internet.defer import CancelledError as DefCancelledError
|
|
||||||
from twisted.internet.task import deferLater
|
|
||||||
|
|
||||||
from evennia.server.models import ServerConfig
|
from evennia.server.models import ServerConfig
|
||||||
from evennia.utils.dbserialize import dbserialize, dbunserialize
|
from evennia.utils.dbserialize import dbserialize, dbunserialize
|
||||||
from evennia.utils.logger import log_err
|
from evennia.utils.logger import log_err
|
||||||
|
from twisted.internet import reactor
|
||||||
|
from twisted.internet.defer import CancelledError as DefCancelledError
|
||||||
|
from twisted.internet.task import deferLater
|
||||||
|
|
||||||
TASK_HANDLER = None
|
TASK_HANDLER = None
|
||||||
|
|
||||||
|
|
@ -251,7 +250,12 @@ class TaskHandler:
|
||||||
to_save = True
|
to_save = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
callback = getattr(obj, method)
|
callback = getattr(obj, method)
|
||||||
|
except Exception as e:
|
||||||
|
log_err(f"TaskHandler: Unable to load task {task_id} (disabling it): {e}")
|
||||||
|
to_save = True
|
||||||
|
continue
|
||||||
self.tasks[task_id] = (date, callback, args, kwargs, True, None)
|
self.tasks[task_id] = (date, callback, args, kwargs, True, None)
|
||||||
|
|
||||||
if self.stale_timeout > 0: # cleanup stale tasks.
|
if self.stale_timeout > 0: # cleanup stale tasks.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue