mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Robustitude\!
This commit is contained in:
parent
77458078e9
commit
e45ad03ef4
@ -90,8 +90,11 @@ class Schedule(drivers.IrcDriver):
|
||||
def addPeriodicEvent(self, f, t, name=None):
|
||||
"""Adds a periodic event that is called every t seconds."""
|
||||
def wrapper():
|
||||
f()
|
||||
return self.addEvent(wrapper, time.time() + t, name)
|
||||
try:
|
||||
f()
|
||||
finally:
|
||||
# Even if it raises an exception, let's schedule it.
|
||||
return self.addEvent(wrapper, time.time() + t, name)
|
||||
return wrapper()
|
||||
|
||||
removePeriodicEvent = removeEvent
|
||||
@ -103,7 +106,10 @@ class Schedule(drivers.IrcDriver):
|
||||
(t, name) = heapq.heappop(self.schedule)
|
||||
f = self.events[name]
|
||||
del self.events[name]
|
||||
f()
|
||||
try:
|
||||
f()
|
||||
except Exception, e:
|
||||
log.exception('Uncaught exception in scheduled function:')
|
||||
|
||||
try:
|
||||
ignore(schedule)
|
||||
|
Loading…
Reference in New Issue
Block a user