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). Delay the calling of a callback (function).
Args: 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)` callback (callable): Will be called as `callback(*args, **kwargs)`
after `timedelay` seconds. after `timedelay` seconds.
args (any, optional): Will be used as arguments to callback args (any): Will be used as arguments to callback.
Keyword Args: Keyword Args:
persistent (bool, optional): Should make the delay persistent persistent (bool, optional): If True the delay remains after a server restart.
over a reboot or reload. Defaults to False. persistent is False by default.
any (any): Will be used as keyword arguments to callback. any (any): Will be used as keyword arguments to callback.
Returns: Returns:
deferred or int: If ``persistent`` kwarg is `False`, return deferred task (TaskHandlerTask): An instance of a task.
that will fire with callback after `timedelay` seconds. Note that Refer to, evennia.scripts.taskhandler.TaskHandlerTask
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.
Note: Note:
The task handler (`evennia.scripts.taskhandler.TASK_HANDLER`) will 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 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 which is the task's id itended for use with TASK_HANDLER's do_task
and remove methods. and remove methods.
All persistent tasks whose time delays have passed will be called on server startup.
All task's whose time delays have passed will be called on server startup.
""" """
global _TASK_HANDLER global _TASK_HANDLER