mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-24 03:29:28 +01:00
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:
parent
0791d9cbea
commit
bb91ade49e
@ -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>
|
||||||
|
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user