Updated world.upkeep to return the number of objects that have been collected and updated the upkeep command to return that number.

This commit is contained in:
Jeremy Fincher 2003-09-03 17:27:08 +00:00
parent 0791d9cbea
commit bb91ade49e
2 changed files with 4 additions and 3 deletions

View File

@ -160,14 +160,14 @@ class OwnerCommands(privmsgs.CapabilityCheckingPrivmsg):
Runs the standard upkeep stuff (flushes and gc.collects()). Runs the standard upkeep stuff (flushes and gc.collects()).
""" """
world.upkeep() collected = world.upkeep()
if gc.garbage: if gc.garbage:
if len(gc.garbage) < 10: if len(gc.garbage) < 10:
irc.reply(msg, 'Garbage! %r' % gc.garbage) irc.reply(msg, 'Garbage! %r' % gc.garbage)
else: else:
irc.reply(msg, 'Garbage! %s items.' % len(gc.garbage)) irc.reply(msg, 'Garbage! %s items.' % len(gc.garbage))
else: else:
irc.reply(msg, conf.replySuccess) irc.reply(msg, '%s collected' % utils.nItems(collected, 'object'))
def set(self, irc, msg, args): def set(self, irc, msg, args):
"""<name> <value> """<name> <value>

View File

@ -79,7 +79,7 @@ except NameError:
def upkeep(): # Function to be run on occasion to do upkeep stuff. def upkeep(): # Function to be run on occasion to do upkeep stuff.
gc.collect() collected = gc.collect()
if os.name == 'nt': if os.name == 'nt':
msvcrt.heapmin() msvcrt.heapmin()
if gc.garbage: if gc.garbage:
@ -88,6 +88,7 @@ def upkeep(): # Function to be run on occasion to do upkeep stuff.
flush() flush()
msg = '%s upkeep ran.' % time.strftime(conf.logTimestampFormat) msg = '%s upkeep ran.' % time.strftime(conf.logTimestampFormat)
debug.msg(msg, 'verbose') debug.msg(msg, 'verbose')
return collected
''' '''
def superReload(oldmodule): def superReload(oldmodule):