aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/async.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2012-08-19 20:59:52 +0000
committerRob Austein <sra@hactrn.net>2012-08-19 20:59:52 +0000
commit40bcc9d68004023b09b84a37e637d3410d5322ad (patch)
tree1b1ef6cbf5a78b95a14992e7ccd09a817b782138 /rpkid/rpki/async.py
parent96dce20631fe89bd9e65949be67739d2d75b5441 (diff)
Tweak timer.runq() to be a bit more even-handed in how we prioritize
I/O versus timers. svn path=/branches/tk274/; revision=4644
Diffstat (limited to 'rpkid/rpki/async.py')
-rw-r--r--rpkid/rpki/async.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/rpkid/rpki/async.py b/rpkid/rpki/async.py
index ecea3bbd..f4786ebf 100644
--- a/rpkid/rpki/async.py
+++ b/rpkid/rpki/async.py
@@ -216,8 +216,13 @@ class timer(object):
"""
Run the timer queue: for each timer whose call time has passed,
pull the timer off the queue and call its handler() method.
+
+ Comparisions are made against time at which this function was
+ called, so that even if new events keep getting scheduled, we'll
+ return to the I/O loop reasonably quickly.
"""
- if timer_queue and rpki.sundial.now() >= timer_queue[0].when:
+ now = rpki.sundial.now()
+ while timer_queue and now >= timer_queue[0].when:
t = timer_queue.pop(0)
if cls.run_debug:
rpki.log.debug("Running %r" % t)