mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-10-11 14:27:26 +02:00
Changed the way upkeep is scheduled.
This commit is contained in:
parent
c958ef5d1c
commit
f496c804a2
@ -73,7 +73,7 @@ def main():
|
|||||||
# all the various plugins, our registry file might be wiped. That's bad.
|
# all the various plugins, our registry file might be wiped. That's bad.
|
||||||
interrupted = False
|
interrupted = False
|
||||||
when = time.time() + conf.supybot.upkeepInterval()
|
when = time.time() + conf.supybot.upkeepInterval()
|
||||||
schedule.addEvent(world.upkeep, when, name='upkeep')
|
schedule.addPeriodicEvent(world.upkeep, when, name='upkeep', now=False)
|
||||||
world.startedAt = started
|
world.startedAt = started
|
||||||
while world.ircs:
|
while world.ircs:
|
||||||
try:
|
try:
|
||||||
|
11
src/world.py
11
src/world.py
@ -50,7 +50,6 @@ import supybot.conf as conf
|
|||||||
import supybot.drivers as drivers
|
import supybot.drivers as drivers
|
||||||
import supybot.ircutils as ircutils
|
import supybot.ircutils as ircutils
|
||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
import supybot.schedule as schedule
|
|
||||||
|
|
||||||
startedAt = time.time() # Just in case it doesn't get set later.
|
startedAt = time.time() # Just in case it doesn't get set later.
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ def debugFlush(s=''):
|
|||||||
log.debug(s)
|
log.debug(s)
|
||||||
flush()
|
flush()
|
||||||
|
|
||||||
def upkeep(scheduleNext=True):
|
def upkeep():
|
||||||
"""Does upkeep (like flushing, garbage collection, etc.)"""
|
"""Does upkeep (like flushing, garbage collection, etc.)"""
|
||||||
sys.exc_clear() # Just in case, let's clear the exception info.
|
sys.exc_clear() # Just in case, let's clear the exception info.
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
@ -115,8 +114,8 @@ def upkeep(scheduleNext=True):
|
|||||||
log.error('Printed to stderr after daemonization: %s', s)
|
log.error('Printed to stderr after daemonization: %s', s)
|
||||||
sys.stderr.reset() # Seeks to 0.
|
sys.stderr.reset() # Seeks to 0.
|
||||||
sys.stderr.truncate() # Truncates to current offset.
|
sys.stderr.truncate() # Truncates to current offset.
|
||||||
flushed = conf.supybot.flush() and not starting
|
doFlush = conf.supybot.flush() and not starting
|
||||||
if flushed:
|
if doFlush:
|
||||||
flush()
|
flush()
|
||||||
# This is so registry._cache gets filled.
|
# This is so registry._cache gets filled.
|
||||||
if registryFilename is not None:
|
if registryFilename is not None:
|
||||||
@ -127,12 +126,10 @@ def upkeep(scheduleNext=True):
|
|||||||
log.debug('HostmaskPatternEqual cache size: %s' %
|
log.debug('HostmaskPatternEqual cache size: %s' %
|
||||||
len(ircutils._hostmaskPatternEqualCache))
|
len(ircutils._hostmaskPatternEqualCache))
|
||||||
#timestamp = log.timestamp()
|
#timestamp = log.timestamp()
|
||||||
if flushed:
|
if doFlush:
|
||||||
log.info('Flushers flushed and garbage collected.')
|
log.info('Flushers flushed and garbage collected.')
|
||||||
else:
|
else:
|
||||||
log.info('Garbage collected.')
|
log.info('Garbage collected.')
|
||||||
if scheduleNext:
|
|
||||||
schedule.addEvent(upkeep, time.time() + conf.supybot.upkeepInterval())
|
|
||||||
collected = gc.collect()
|
collected = gc.collect()
|
||||||
if gc.garbage:
|
if gc.garbage:
|
||||||
log.warning('Noncollectable garbage (file this as a bug on SF.net): %s',
|
log.warning('Noncollectable garbage (file this as a bug on SF.net): %s',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user