From bb91ade49e3da192a19cd8d5d9cfda82d7d5eb8f Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 3 Sep 2003 17:27:08 +0000 Subject: [PATCH] Updated world.upkeep to return the number of objects that have been collected and updated the upkeep command to return that number. --- src/OwnerCommands.py | 4 ++-- src/world.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/OwnerCommands.py b/src/OwnerCommands.py index a6fc6b666..9bb6c5541 100644 --- a/src/OwnerCommands.py +++ b/src/OwnerCommands.py @@ -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): """ diff --git a/src/world.py b/src/world.py index 0847cb1ff..0f020b8da 100644 --- a/src/world.py +++ b/src/world.py @@ -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):