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