[Twisted-Python] LoopingCall at a non-idling reactor

Terry Jones terry at jon.es
Sat Jul 18 16:20:06 EDT 2009


>>>>> "Glyph" == Glyph Lefkowitz <glyph at twistedmatrix.com> writes:
Glyph> On Sat, Jul 18, 2009 at 3:33 PM, Ilya Etingof<ilya at glas.net> wrote:
>> I can't get Twisted reactor calling my function in a more or less
>> periodic fashion with the LoopingCall mechanics.
>> 
>> With select()-based reactor, the LoopingCall object seems to call back my
>> timer function only on select() timeout. If I/O pace does not allow
>> select() to time out, LoopingCall never calls my function.

Glyph> This doesn't sound accurate to me.  If your reactor is constantly
Glyph> doing I/O, the timed call in question will be called when the
Glyph> appropriate amount of time has passed.

The thing that occurred to me was that the function called by the looping
call is taking a while (i.e., longer than the loop time) but that Ilya is
expecting his function to be called every X seconds no matter what.

If that's the case Ilya, LoopingCall doesn't work that way. Only one call
can be in progress at a time. When that call is done, another is scheduled.
See the _reschedule method in t.i.task#LoopingCall for more detail.

Terry



More information about the Twisted-Python mailing list