On Mon, Jul 20, 2009 at 8:26 AM, David Guerin <da...@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: <
http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.task.LoopingCall.html>,
like so:

from twisted.internet.task import LoopingCall
MINUTES = 60.0
def myTimer():
      doSomeStuff()
repeater = LoopingCall(myTimer)
repeater.start(5 * MINUTES)
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to