Merge pull request #2412 from davewiththenicehat/delay_docstring_update

delay docstring update
This commit is contained in:
Griatch 2021-05-11 23:48:12 +02:00 committed by GitHub
commit e382e0e34f

View file

@ -1025,24 +1025,19 @@ def delay(timedelay, callback, *args, **kwargs):
Delay the calling of a callback (function).
Args:
timedelay (int or float): The delay in seconds
timedelay (int or float): The delay in seconds.
callback (callable): Will be called as `callback(*args, **kwargs)`
after `timedelay` seconds.
args (any, optional): Will be used as arguments to callback
args (any): Will be used as arguments to callback.
Keyword Args:
persistent (bool, optional): Should make the delay persistent
over a reboot or reload. Defaults to False.
persistent (bool, optional): If True the delay remains after a server restart.
persistent is False by default.
any (any): Will be used as keyword arguments to callback.
Returns:
deferred or int: If ``persistent`` kwarg is `False`, return deferred
that will fire with callback after `timedelay` seconds. Note that
if `timedelay()` is used in the commandhandler callback chain, the
callback chain can be defined directly in the command body and
don't need to be specified here. Reference twisted.internet.defer.Deferred.
If persistent kwarg is set, return the task's ID as an integer. This is
intended for use with ``evennia.scripts.taskhandler.TASK_HANDLER``
`.do_task` and `.remove` methods.
task (TaskHandlerTask): An instance of a task.
Refer to, evennia.scripts.taskhandler.TaskHandlerTask
Note:
The task handler (`evennia.scripts.taskhandler.TASK_HANDLER`) will
@ -1057,8 +1052,7 @@ def delay(timedelay, callback, *args, **kwargs):
If persistent is set to True the delay function will return an int
which is the task's id itended for use with TASK_HANDLER's do_task
and remove methods.
All task's whose time delays have passed will be called on server startup.
All persistent tasks whose time delays have passed will be called on server startup.
"""
global _TASK_HANDLER