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()).
"""
world.upkeep()
collected = world.upkeep()
if gc.garbage:
if len(gc.garbage) < 10:
irc.reply(msg, 'Garbage! %r' % gc.garbage)
else:
irc.reply(msg, 'Garbage! %s items.' % len(gc.garbage))
else:
irc.reply(msg, conf.replySuccess)
irc.reply(msg, '%s collected' % utils.nItems(collected, 'object'))
def set(self, irc, msg, args):
"""<name> <value>

View File

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