zephyr_mirror: Clear all notices from the queue before selecting.
We were having problems where we were suspiciously processing notices at a rate of 1 notice per 15s, which suggests that we the select was timing out even though there were notices to be fetched immediately. We fix this by clearing the queue each time our select loop ends. (imported from commit 7e7bfbb2126d1f4170d65d1483a0b799dcab80b9)
This commit is contained in:
parent
a56cdac823
commit
d706057ed8
|
@ -267,17 +267,20 @@ def process_loop(log):
|
|||
while True:
|
||||
select.select([zephyr._z.getFD()], [], [], 15)
|
||||
try:
|
||||
notice = zephyr.receive(block=False)
|
||||
# Fetch notices from the queue until its empty
|
||||
while True:
|
||||
notice = zephyr.receive(block=False)
|
||||
if notice is None:
|
||||
break
|
||||
try:
|
||||
process_notice(notice, log)
|
||||
except Exception:
|
||||
logger.exception("Error relaying zephyr:")
|
||||
time.sleep(2)
|
||||
except Exception:
|
||||
logger.exception("Error checking for new zephyrs:")
|
||||
time.sleep(1)
|
||||
continue
|
||||
if notice is not None:
|
||||
try:
|
||||
process_notice(notice, log)
|
||||
except Exception:
|
||||
logger.exception("Error relaying zephyr:")
|
||||
time.sleep(2)
|
||||
|
||||
if time.time() - last_check_time > 15:
|
||||
last_check_time = time.time()
|
||||
|
|
Loading…
Reference in a new issue