From 397d58c459041d6f7a106b85bcfa546855497e01 Mon Sep 17 00:00:00 2001 From: jessicamack Date: Mon, 24 Apr 2023 10:39:36 -0400 Subject: [PATCH] removed TODO. moved signal catches to handle() Signed-off-by: jessicamack --- awx/main/management/commands/run_heartbeet.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/awx/main/management/commands/run_heartbeet.py b/awx/main/management/commands/run_heartbeet.py index 5161769488..a7dab206f4 100644 --- a/awx/main/management/commands/run_heartbeet.py +++ b/awx/main/management/commands/run_heartbeet.py @@ -59,17 +59,15 @@ class Command(BaseCommand): def do_hearbeat_loop(self): with pg_bus_conn(new_connection=True) as conn: - signal.signal(signal.SIGTERM, self.notify_listener_and_exit) - signal.signal(signal.SIGINT, self.notify_listener_and_exit) while True: logger.debug('Sending heartbeat') conn.notify('web_heartbeet', self.construct_payload()) time.sleep(settings.BROADCAST_WEBSOCKET_BEACON_FROM_WEB_RATE_SECONDS) - # TODO: Send a message with action=offline if we notice a SIGTERM or SIGINT - # (wsrelay can use this to remove the node quicker) def handle(self, *arg, **options): self.print_banner() + signal.signal(signal.SIGTERM, self.notify_listener_and_exit) + signal.signal(signal.SIGINT, self.notify_listener_and_exit) # Note: We don't really try any reconnect logic to pg_notify here, # just let supervisor restart if we fail.