[Twisted-Python] Accurate delays in callLater

Ian Duggan ian at ianduggan.net
Thu Jun 23 13:34:41 MDT 2005


On Thursday 23 June 2005 11:27, Norm Petterson wrote:
> http://twistedmatrix.com/pipermail/twisted-python/2004-March/007254.html,
> I've been using twisted.internet.task.LoopingCall for applications
> calling for 1 second (or 2 second, or 10 second, etc.) indefinite
> repetition for the past year, and have noted minor slippage that I
> attribute to *not* bumping the twisted application process priority
> above its default on the platforms involved (Linux/DEC Alpha, W2K/Intel
> P4). If the slippage were unacceptable, I'd try raising process priority
> before anything else...

Another idea is to do the bookkeeping yourself. 

1) Schedule something to wake up periodically. The period would depend on your 
desired level of smoothness.

2) Have it perform your task. 

3) If it notices that things are slipping (numer exectutions < number expected 
excutions) based on time.time(), it can run your operation however many times 
it needs to catch up.

--Ian




More information about the Twisted-Python mailing list