From 43acb4fddedf22b112a07f1a192e89fd613d0286 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 14 Feb 2013 12:04:45 -0500 Subject: [PATCH] zmirror: Use backoff-retry code for the outer loop. Realistically, if the bot crashes once, it'll probably crash the next time too, so I'm not convinced we need this loop at all, but in the interests of avoiding churn on an extensively tested script, I'm going to err on the side of the minimal change here. (imported from commit e2bbd3700395ba4d0b181a4616e816e8f1231669) --- bots/zephyr_mirror.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bots/zephyr_mirror.py b/bots/zephyr_mirror.py index a012515..ceffbc4 100755 --- a/bots/zephyr_mirror.py +++ b/bots/zephyr_mirror.py @@ -30,6 +30,7 @@ import traceback import signal from zephyr_mirror_backend import parse_args +from zephyr_mirror_backend import RandomExponentialBackoff def die(signal, frame): # We actually want to exit, so run os._exit (so as not to be caught and restarted) @@ -59,10 +60,19 @@ if options.forward_class_messages and not options.noshard: pass sys.exit(0) -while True: +backoff = RandomExponentialBackoff() +while backoff.keep_going(): print "Starting zephyr mirroring bot" try: subprocess.call(args) except: traceback.print_exc() - time.sleep(1) + backoff.fail() + +print "" +print "" +print "ERROR: The Zephyr mirroring bot is unable to continue mirroring Zephyrs." +print "This is often caused by failing to maintain unexpired Kerberos tickets" +print "or AFS tokens." +print "" +sys.exit(1)