a.i.Delay(object) : class documentation
I let you delay things and wait for things that may take a while, in Twisted fashion.
Perhaps a bit more suited to the
util module, but that would require this module to import it, and it imports this module.
With event delays of 100 ms to 1 second (in
process.ProcessWorker, setting backoff to 1.10 seems more efficient than 1.05 or 1.20, with the (initial) interval of 50 ms. However, you may want to tune things for your application and system.
|Instance Variable||interval||The initial event-checking interval, in seconds. (type: float)|
|Instance Variable||backoff||The backoff exponent. (type: float)|
Deferred that fires after my default delay interval or one you specify. You can have it fire in the next reactor iteration by setting delay to zero (not
None, as that will use the default delay instead).
The default interval is 10ms unless you override that in by setting my interval attribute to something else.
def untilEvent(self, eventChecker, *args, **kw):
Deferred that fires when a call to the supplied event-checking callable returns an affirmative (not
False, etc.) result, or until the optional timeout limit is reached. The result of the
True if the event actually happened, or
False if a timeout occurred.
The event checker should not return a
Deferred. I call the event checker less and less frequently as the wait goes on, depending on the backoff exponent (default is
|Parameters||eventChecker||A no-argument callable that returns an immediate boolean value indicating if an event occurred.|