Clean up process_loop's structure.

(imported from commit 62e427bf22d56960286b237f54660e74fb2866d8)
This commit is contained in:
Tim Abbott 2012-10-12 14:51:28 -04:00
parent a8fc07c745
commit 92496fa90f

View file

@ -137,22 +137,22 @@ def process_loop(log):
sleep_time = 0.1 sleep_time = 0.1
while True: while True:
notice = zephyr.receive(block=False) notice = zephyr.receive(block=False)
if notice is None: if notice is not None:
time.sleep(sleep_time) try:
sleep_count += sleep_time process_notice(notice, log)
if sleep_count > 15: except:
sleep_count = 0 print >>sys.stderr, 'Error relaying zephyr'
if options.forward_class_messages: traceback.print_exc()
# Ask the Humbug server about any new classes to subscribe to time.sleep(2)
update_subscriptions_from_humbug()
continue
try: time.sleep(sleep_time)
process_notice(notice, log) sleep_count += sleep_time
except: if sleep_count > 15:
print >>sys.stderr, 'Error relaying zephyr' sleep_count = 0
traceback.print_exc() if options.forward_class_messages:
time.sleep(2) # Ask the Humbug server about any new classes to subscribe to
update_subscriptions_from_humbug()
continue
def process_notice(notice, log): def process_notice(notice, log):
zsig, body = notice.message.split("\x00", 1) zsig, body = notice.message.split("\x00", 1)