Skip to content

Commit 50a213a

Browse files
author
Matthew
committed
ref(controller): iterate over backoff interval array
Instead of hardcoding 4, we can update the backoff interval as needed and the loop will be updated as expected.
1 parent cd794aa commit 50a213a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

controller/api/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def _healthcheck(self, containers, config):
381381
# HACK (bacongobbler): we need to wait until publisher has a chance to publish each
382382
# service to etcd, which can take up to 20 seconds.
383383
time.sleep(20)
384-
for i in range(0, 4):
384+
for i in range(len(intervals)):
385385
delay = int(config.get('HEALTHCHECK_INITIAL_DELAY', 0))
386386
try:
387387
# sleep until the initial timeout is over
@@ -391,8 +391,8 @@ def _healthcheck(self, containers, config):
391391
break
392392
except exceptions.HealthcheckException as e:
393393
try:
394-
new_delay = delay * intervals[i+1]
395-
msg = "{}; trying again in {} seconds".format(e, new_delay)
394+
next_delay = delay * intervals[i+1]
395+
msg = "{}; trying again in {} seconds".format(e, next_delay)
396396
log_event(self, msg, logging.WARNING)
397397
except IndexError:
398398
log_event(self, e, logging.WARNING)

0 commit comments

Comments
 (0)