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()).
"""
collected = world.upkeep()
collected = world.upkeep(scheduleNext=False)
if gc.garbage:
irc.reply('Garbage! %r' % gc.garbage)
else:

View File

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