mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 15:07:16 +02:00
Fix a bug in the permanent delay when the object is destroyed
This commit is contained in:
parent
b737c209b1
commit
3176f4b100
1 changed files with 8 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ class TaskHandler(object):
|
|||
It populates `self.tasks` according to the ServerConfig.
|
||||
|
||||
"""
|
||||
to_save = False
|
||||
value = ServerConfig.objects.conf("delayed_tasks", default={})
|
||||
if isinstance(value, basestring):
|
||||
tasks = dbunserialize(value)
|
||||
|
|
@ -51,9 +52,16 @@ class TaskHandler(object):
|
|||
if isinstance(callback, tuple):
|
||||
# `callback` can be an object and name for instance methods
|
||||
obj, method = callback
|
||||
if obj is None:
|
||||
to_save = True
|
||||
continue
|
||||
|
||||
callback = getattr(obj, method)
|
||||
self.tasks[task_id] = (date, callback, args, kwargs)
|
||||
|
||||
if to_save:
|
||||
self.save()
|
||||
|
||||
def save(self):
|
||||
"""Save the tasks in ServerConfig."""
|
||||
for task_id, (date, callback, args, kwargs) in self.tasks.items():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue