From 949aeee8068cddd36c830c72199c8cfe6d42953a Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 1 Sep 2016 15:14:53 +0200 Subject: [PATCH] Update docstring: Better describes the limits of the callables possible to use with TickerHandler. --- evennia/scripts/tickerhandler.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/evennia/scripts/tickerhandler.py b/evennia/scripts/tickerhandler.py index 790b72d7f3..c80ac64fa6 100644 --- a/evennia/scripts/tickerhandler.py +++ b/evennia/scripts/tickerhandler.py @@ -18,8 +18,15 @@ Example: TICKER_HANDLER.add(15, myobj.at_tick, *args, **kwargs) ``` -You supply the interval to tick and a callable to call regularly -with any extra args/kwargs. The handler will transparently set +You supply the interval to tick and a callable to call regularly with +any extra args/kwargs. The callable should either be a stand-alone +function in a module *or* the method on a *typeclassed* entity (that +is, on an object that can be safely and stably returned from the +database). Functions that are dynamically created or sits on +in-memory objects cannot be used by the tickerhandler (there is no way +to reference them safely across reboots and saves). + +The handler will transparently set up and add new timers behind the scenes to tick at given intervals, using a TickerPool - all callables with the same interval will share the interval ticker. @@ -470,7 +477,8 @@ class TickerHandler(object): a server reload. If this is unset, the ticker will be deleted by a server shutdown. args, kwargs (optional): These will be passed into the - callback every time it is called. + callback every time it is called. This must be data possible + to pickle! Notes: The callback will be identified by type and stored either as