zephyr_mirror: Limit logging of errors when checking restart stamps.

(imported from commit 194b30d757a5f20d6d20bc8aed9154c6aece9837)
This commit is contained in:
Tim Abbott 2013-04-04 10:21:42 -04:00
parent 8f17166ec6
commit 5af166e063

View file

@ -258,6 +258,7 @@ def maybe_restart_mirroring_script():
time.sleep(1)
def process_loop(log):
restart_check_count = 0
sleep_count = 0
sleep_time = 0.1
while True:
@ -276,8 +277,13 @@ def process_loop(log):
try:
maybe_restart_mirroring_script()
if restart_check_count > 0:
logging.info("Stopped getting errors checking whether restart is required.")
restart_check_count = 0
except Exception:
logger.exception("Error checking whether restart is required:")
if restart_check_count < 5:
logger.exception("Error checking whether restart is required:")
restart_check_count += 1
time.sleep(sleep_time)
sleep_count += sleep_time