twisted.internet.task.LoopingCall.withCount(cls, countCallable)
class method documentationtwisted.internet.task.LoopingCall
View Source
An alternate constructor for LoopingCall
that makes available the number of calls which should have occurred since it was last invoked.
Note that this number is an int
value; It represents the discrete number of calls that should have been made. For example, if you are using a looping call to display an animation with discrete frames, this number would be the number of frames to advance.
The count is normally 1, but can be higher. For example, if the reactor is blocked and takes too long to invoke the LoopingCall
, a Deferred returned from a previous call is not fired before an interval has elapsed, or if the callable itself blocks for longer than an interval, preventing itself from being called.
When running with an interval if 0, count will be always 1.
Parameters | countCallable | A callable that will be invoked each time the resulting LoopingCall is run, with an integer specifying the number of calls that should have been invoked. (type: 1-argument callable which takes an int ) |
Returns | An instance of LoopingCall with call counting enabled, which provides the count as the first positional argument. (type: LoopingCall ) | |
Present Since | 9.0 |
Function | counter | Undocumented |