removed TODO. moved signal catches to handle()

Signed-off-by: jessicamack <jmack@redhat.com>
This commit is contained in:
jessicamack 2023-04-24 10:39:36 -04:00
parent d739a4a90a
commit 397d58c459

View File

@ -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.