[Twisted-Python] callLater
Manlio Perillo
manlio_perillo at libero.it
Mon Sep 4 10:02:51 MDT 2006
Hi.
I need to implement a function for scheduling function calls at specific
times.
A simple implementation is:
def callAt(when):
from twisted.internet import reactor
delta = when - datetime.now()
delay = delta.days * 24 * 3600 + delta.seconds + delta.microseconds
/ 1000000.
return reactor.callLater(delay)
However I'm going to have lots of this scheduled calls, many of these
are far away in the future.
Can this be a problem?
An alternative implementation is to use LoopingCall that, say, every 15
minutes, check the scheduled functions.
Here I can think of some optimization, to avoid a linear search.
Thanks Manlio Perillo
More information about the Twisted-Python
mailing list