[Twisted-Python] Timers in Twisted

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Jul 20 08:36:47 EDT 2009

On Mon, Jul 20, 2009 at 8:26 AM, David Guerin <david at strotos.com> wrote:

> Hey all,
> I'm pretty new to Twisted Framework but things are going along nicely.
> At the moment I am trying to get a timer to fire off say every 5
> minutes.
> What's the best way to do this with twisted?
> I found an old link to a how to with timers in twisted on the
> twistedmatrix.com site but there wasn't a web page there when I clicked

You can use LoopingCall: <
like so:

from twisted.internet.task import LoopingCall
MINUTES = 60.0
def myTimer():
repeater = LoopingCall(myTimer)
repeater.start(5 * MINUTES)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090720/cdfd58ce/attachment.htm 

More information about the Twisted-Python mailing list