My LoopingCall task stops when it executes an errorcallback and I want to restart it.
My code looks something like this but I am not sure if I am doing it right or which would be the best way
from twisted.internet.task import LoopingCall
from twisted.internet import reactor
PROCESS_INTERVAL = 1
def periodic_task():
print notDefined
def periodic_task_crashed(error):
print "periodic task crashed"
lc = LoopingCall(periodic_task)
d = lc.start(PROCESS_INTERVAL)
d.addErrback(periodic_task_crashed)
reactor.run()
Then for now in my error callback I do this...
def periodic_task_crashed(reason):
d = lc.start(PROCESS_INTERVAL)
d.addErrback(periodic_task_crashed)
Is this the right way to do it? Could it enter in a recursive error loop?