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
setting backoff to 1.10 seems more efficient than 1.05 or 1.20, with
an (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)|
|Method||shutdown||This gets called before the reactor shuts down. Causes any pending
This gets called before the reactor shuts down. Causes any pending
calls to finish up pronto.
Does not return a
Deferred, because it doesn't return until
it's forced everything to wind up.
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
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 result, or until the
optional timeout limit is reached.
An affirmative result evaluates at
False, zero, etc.) The result of the
True if the event actually happened,
False if a timeout occurred. Call with:
- eventChecker: A callable that returns an immediate boolean value indicating if an event occurred.
- *args: Any args for the event checker callable.
- **kw: Any keywords for the event checker callable.
The event checker should not return a
call the event checker less and less frequently as the wait goes on,
depending on the backoff exponent (default is