From c0d39fd4a2deb6ce76bc08866a88353780916d06 Mon Sep 17 00:00:00 2001 From: mike seibel Date: Thu, 5 Nov 2020 14:35:47 -0800 Subject: [PATCH] mgmt daemon delay more of period spec --- scripts/management_daemon.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/management_daemon.py b/scripts/management_daemon.py index 006c589..c90cdc7 100644 --- a/scripts/management_daemon.py +++ b/scripts/management_daemon.py @@ -117,6 +117,7 @@ def handler(signum, frame): report("exception: {}".format(ex), error=True) finish = time.time() + duration = finish - start management_daemon_command_exit.labels( command, release_id).set(rv if rv and isinstance(rv, int) else 0) @@ -125,10 +126,11 @@ def handler(signum, frame): management_daemon_command_finish.labels( command, release_id).set(finish) management_daemon_command_duration.labels( - command, release_id).set(finish - start) + command, release_id).set(duration) - if not finish_signal: - time.sleep(loop_delay) + delay_delta = loop_delay - int(duration) + if delay_delta > 0 and not finish_signal: + time.sleep(delay_delta) if __name__ == '__main__':