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,7 +137,14 @@ def process_loop(log):
sleep_time = 0.1
while True:
notice = zephyr.receive(block=False)
if notice is None:
if notice is not None:
try:
process_notice(notice, log)
except:
print >>sys.stderr, 'Error relaying zephyr'
traceback.print_exc()
time.sleep(2)
time.sleep(sleep_time)
sleep_count += sleep_time
if sleep_count > 15:
@ -147,13 +154,6 @@ def process_loop(log):
update_subscriptions_from_humbug()
continue
try:
process_notice(notice, log)
except:
print >>sys.stderr, 'Error relaying zephyr'
traceback.print_exc()
time.sleep(2)
def process_notice(notice, log):
zsig, body = notice.message.split("\x00", 1)
is_personal = False