Skip to content

Commit

Permalink
Fix bug in checking healthChecks at first (d2iq-archive#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
chozo99 committed Nov 8, 2019
1 parent 352392c commit 80771bf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions marathon_lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1691,10 +1691,10 @@ def get_apps(marathon, apps=[]):
for task in new['tasks']:
if 'healthCheckResults' not in task:
continue
alive = True
alive = False
for result in task['healthCheckResults']:
if not result['alive']:
alive = False
if result['alive']:
alive = True
if alive:
healthy_new_instances += 1
else:
Expand Down Expand Up @@ -1802,15 +1802,15 @@ def get_apps(marathon, apps=[]):

if marathon.health_check() and 'healthChecks' in app and \
len(app['healthChecks']) > 0:
alive = True
alive = False
if 'healthCheckResults' not in task:
# use previously cached result, if it exists
if not healthCheckResultCache.get(task['id'], False):
continue
else:
for result in task['healthCheckResults']:
if not result['alive']:
alive = False
if result['alive']:
alive = True
healthCheckResultCache.set(task['id'], alive)
if not alive:
continue
Expand Down

0 comments on commit 80771bf

Please sign in to comment.