diff options
author | Zuul <zuul@review.opendev.org> | 2019-07-26 16:26:11 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-07-26 16:26:11 +0000 |
commit | d992b465ff16b2595697e503f64ccf333f8a9ddb (patch) | |
tree | 0456193f25a73766abe4bea11f56b7b867478a20 /heat/common | |
parent | 98f08fe079d94422ff1a59fd4531c5af850d1639 (diff) | |
parent | fd23308f6ec20e4441d8da486a4f6930a2ba366d (diff) | |
download | heat-d992b465ff16b2595697e503f64ccf333f8a9ddb.tar.gz |
Merge "Show an engine as down if service record is not updated twice"
Diffstat (limited to 'heat/common')
-rw-r--r-- | heat/common/service_utils.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/heat/common/service_utils.py b/heat/common/service_utils.py index b5cf00485..a59fef8e8 100644 --- a/heat/common/service_utils.py +++ b/heat/common/service_utils.py @@ -51,14 +51,10 @@ def format_service(service): return status = 'down' - if service.updated_at is not None: - if ((timeutils.utcnow() - service.updated_at).total_seconds() - <= service.report_interval): - status = 'up' - else: - if ((timeutils.utcnow() - service.created_at).total_seconds() - <= service.report_interval): - status = 'up' + last_updated = service.updated_at or service.created_at + check_interval = (timeutils.utcnow() - last_updated).total_seconds() + if check_interval <= 2 * service.report_interval: + status = 'up' result = { SERVICE_ID: service.id, |