cherrypy.process.plugins.Monitor and task longer than frequency

194 views
Skip to first unread message

Łukasz Michalski

unread,
Sep 14, 2010, 5:20:28 AM9/14/10
to cherrypy-users
Hi,

What will happen if my callback will last longer than a frequency passed
to cherrypy.process.plugins.Monitor?

Will Monitor wait for callback to finish and call it again immediately
or call callback second time without waiting for the first one to finish?

Thanks,
Łukasz

Robert Brewer

unread,
Sep 14, 2010, 12:10:13 PM9/14/10
to cherryp...@googlegroups.com
Here's the code for it (in trunk):

def run(self):
self.running = True
while self.running:
time.sleep(self.interval)
if not self.running:
return
try:
self.function(*self.args, **self.kwargs)
except Exception, x:
self.bus.log("Error in background task thread function %r." %
self.function, level=40, traceback=True)
# Quit on first error to avoid massive logs.
raise

Looks like it will pause for the same amount of time in between each run, regardless of how long that run takes.


Robert Brewer
fuma...@aminus.org
Reply all
Reply to author
Forward
0 new messages