[Twisted-Python] Deterministic TimerService
Norm Petterson
njp at njp.us
Thu Mar 4 09:08:04 MST 2004
Hi,
Thanks for such a useful framework.
While working on an industrial data logger using Twisted, I found that
application.internet.TimerService calls my own callLater callable function
before reissuing the next callLater. Consequently, instead of a time period
c, the callable function runs every c+x, where x is the duration of my own
function, and thus appears to slip over time.
Based on my past experiences with DEC RSX "mark time" and VMS "set timer" in
similar situations, I recommend changing:
def setupCall():
self.callable(*self.args, **self.kwargs)
self._call = reactor.callLater(self.step, setupCall)
to
def setupCall():
self._call = reactor.callLater(self.step, setupCall)
self.callable(*self.args, **self.kwargs)
Reissuing the timer request first appears to work more as I'd expect,
particularly as I am using timestamp information for each scan to compute an
appropriate bsddb record number in a persistent circular buffer. Any other
opinions?
Regards,
Norm Petterson
More information about the Twisted-Python
mailing list