[Twisted-Python] Twisted-Python Digest, Vol 63, Issue 7

Doug Farrell dfarrell at mypublisher.com
Mon Jun 8 10:46:03 EDT 2009


> Hi Doug
> Sorry if it sounds like I'm being a PITA, but I really recommend
> reading
> the source code and writing & playing with a tiny example. Also see
> ingCall.html
> I suggest this because it's by far the best way to learn these things.
> And
> if you're using Twisted in any serious way, it's hard to get by
> getting closely acquainted with some of the code.
> BTW, yes, LoopingCall will reschedule in a sensible way, supposing
> task returns a deferred that takes a long time to fire :-) Try it.
> Terry

[Doug Farrell] Don't mind the PITA at all, I actuall did read the source
code and just didn't 'get it' so much. In my case the function that
LoopingCall was passed was actually doing the work, not returning a
Deferred. However, I'm going to look into doing that. 

Thanks for your feedback and advice,

> per
> opingCall.html
> If someFunction returns a Deferred, it will not be rescheduled if the
> Deferred has not fired.
> e.g.
> def someFunction():
>     d = someDeferredReturningOperation()
>     d.addCallbacks(success, error)
>     return d
> lp = LoopingCall(someFunction)
> lp.start(5.0)   # run every 5 seconds
> Lucas
[Doug Farrell] 

Thanks for your response and feedback. In my sample code the
someFunction() code was actually doing the work I wanted, not creating a
deferred as your sample shows. However, I'm going to try that out and
give it a run.


More information about the Twisted-Python mailing list