Fixed the problem of having multiple upkeeps scheduled.

This commit is contained in:
Jeremy Fincher 2004-02-17 18:10:27 +00:00
parent 3851d1d152
commit e609d5dfd7
2 changed files with 4 additions and 3 deletions

View File

@ -379,7 +379,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
Runs the standard upkeep stuff (flushes and gc.collects()). Runs the standard upkeep stuff (flushes and gc.collects()).
""" """
collected = world.upkeep() collected = world.upkeep(scheduleNext=False)
if gc.garbage: if gc.garbage:
irc.reply('Garbage! %r' % gc.garbage) irc.reply('Garbage! %r' % gc.garbage)
else: else:

View File

@ -77,7 +77,7 @@ def flush():
except Exception, e: except Exception, e:
log.exception('Uncaught exception in flusher:') log.exception('Uncaught exception in flusher:')
def upkeep(): def upkeep(scheduleNext=True):
"""Does upkeep (like flushing, garbage collection, etc.)""" """Does upkeep (like flushing, garbage collection, etc.)"""
sys.exc_clear() # Just in case, let's clear the exception info. sys.exc_clear() # Just in case, let's clear the exception info.
collected = gc.collect() collected = gc.collect()
@ -107,7 +107,8 @@ def upkeep():
log.info('%s Flushers flushed and garbage collected.', timestamp) log.info('%s Flushers flushed and garbage collected.', timestamp)
else: else:
log.info('%s Garbage collected.', timestamp) log.info('%s Garbage collected.', timestamp)
schedule.addEvent(upkeep, time.time() + conf.supybot.upkeepInterval()) if scheduleNext:
schedule.addEvent(upkeep, time.time() + conf.supybot.upkeepInterval())
return collected return collected
def makeDriversDie(): def makeDriversDie():