[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[minion-cvs] Fix a nasty bug in the scheduler code.
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv17868/server
Modified Files:
ServerMain.py
Log Message:
Fix a nasty bug in the scheduler code.
If any scheduled event (shred, timeout, or mix) took so long to complete
that the next event would start immediately, the next event would reschedule
itself based on the time of the *first* event. If the first event took
longer than the reschedule interval of the second event, the second event
would reschedule itself in the past, and start the cycle over again.
Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ServerMain.py 7 Jan 2003 19:19:54 -0000 1.25
+++ ServerMain.py 8 Jan 2003 03:56:54 -0000 1.26
@@ -297,7 +297,7 @@
# 'MIX', 'SHRED', and 'TIMEOUT'. Kept in sorted order.
scheduledEvents = []
now = time.time()
- scheduledEvents.append( (now + 6000, "SHRED") )#FFFF make configurable
+ scheduledEvents.append( (now + 600, "SHRED") )#FFFF make configurable
scheduledEvents.append( (self.mmtpServer.getNextTimeoutTime(now),
"TIMEOUT") )
nextMix = self.mixPool.getNextMixTime(now)
@@ -315,7 +315,8 @@
# ???? Possible solutions: Multiple threads or processes...?
while 1:
nextEventTime = scheduledEvents[0][0]
- timeLeft = nextEventTime - time.time()
+ now = time.time()
+ timeLeft = nextEventTime - now
while timeLeft > 0:
# Handle pending network events
self.mmtpServer.process(timeLeft)
@@ -340,7 +341,7 @@
LOG.debug("Overwriting deleted files")
self.cleanQueues()
insort(scheduledEvents,
- (now + 6000, "SHRED"))
+ (now + 600, "SHRED"))
elif event == 'MIX':
# Before we mix, we need to log the hashes to avoid replays.
# FFFF We need to recover on server failure.