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:
|
while True:
|
||||||
select.select([zephyr._z.getFD()], [], [], 15)
|
select.select([zephyr._z.getFD()], [], [], 15)
|
||||||
try:
|
try:
|
||||||
|
# Fetch notices from the queue until its empty
|
||||||
|
while True:
|
||||||
notice = zephyr.receive(block=False)
|
notice = zephyr.receive(block=False)
|
||||||
except Exception:
|
if notice is None:
|
||||||
logger.exception("Error checking for new zephyrs:")
|
break
|
||||||
time.sleep(1)
|
|
||||||
continue
|
|
||||||
if notice is not None:
|
|
||||||
try:
|
try:
|
||||||
process_notice(notice, log)
|
process_notice(notice, log)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Error relaying zephyr:")
|
logger.exception("Error relaying zephyr:")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Error checking for new zephyrs:")
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
|
|
||||||
if time.time() - last_check_time > 15:
|
if time.time() - last_check_time > 15:
|
||||||
last_check_time = time.time()
|
last_check_time = time.time()
|
||||||
|
|
Loading…
Reference in a new issue