Add a new Instance.health_check_started field

This will enable us to provide more useful information for the user,
now that all user-triggered health checks are async.

Also, de-bounce the health check endpoint to not allow additional
health check tasks to be triggered when one is already in progress.
This commit is contained in:
Jeff Bradberry
2022-09-27 10:34:47 -04:00
parent 84fa19f2ad
commit 65179d9cd0
5 changed files with 46 additions and 4 deletions

View File

@@ -464,7 +464,7 @@ def inspect_execution_nodes(instance_list):
continue
# Control-plane nodes are dealt with via local_health_check instead.
if instance.node_type in ('control', 'hybrid'):
if instance.node_type in (Instance.Types.CONTROL, Instance.Types.HYBRID):
continue
last_seen = parse_date(ad['Time'])
@@ -474,7 +474,7 @@ def inspect_execution_nodes(instance_list):
instance.save(update_fields=['last_seen'])
# Only execution nodes should be dealt with by execution_node_health_check
if instance.node_type == 'hop':
if instance.node_type == Instance.Types.HOP:
if instance.node_state in (Instance.States.UNAVAILABLE, Instance.States.INSTALLED):
logger.warning(f'Hop node {hostname}, has rejoined the receptor mesh')
instance.save_health_data(errors='')