mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
catch SIGTERM or SIGINT and send offline message
Signed-off-by: jessicamack <jmack@redhat.com>
This commit is contained in:
parent
7fda4b0675
commit
919d1e5d40
@ -2,6 +2,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import signal
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
@ -56,6 +57,8 @@ class Command(BaseCommand):
|
||||
logger.debug('Sending heartbeat')
|
||||
conn.notify('web_heartbeet', self.construct_payload())
|
||||
time.sleep(settings.BROADCAST_WEBSOCKET_BEACON_FROM_WEB_RATE_SECONDS)
|
||||
signal.signal(signal.SIGTERM, conn.notify('web_heartbeet', self.construct_payload(action='offline')))
|
||||
signal.signal(signal.SIGINT, conn.notify('web_heartbeet', self.construct_payload(action='offline')))
|
||||
|
||||
# TODO: Send a message with action=offline if we notice a SIGTERM or SIGINT
|
||||
# (wsrelay can use this to remove the node quicker)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user