Skip to content

Commit e898b9d

Browse files
author
Alexey Tsitkin
committed
another try
1 parent 9c5fd85 commit e898b9d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

eb_sqs/worker/service.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ def __init__(self):
3535

3636
def process_queues(self, queue_names):
3737
# type: (list) -> None
38-
def termination_handler(signum, frame):
39-
logger.info('[django-eb-sqs] Termination signal called: {}'.format(signum))
40-
self._exit_called()
41-
42-
signal.signal(signal.SIGTERM, termination_handler)
43-
signal.signal(signal.SIGKILL, termination_handler)
38+
signal.signal(signal.SIGTERM, self._exit_called)
39+
signal.signal(signal.SIGKILL, self._exit_called)
4440

4541
self.write_healthcheck_file()
4642
self._last_healthcheck_time = timezone.now()
@@ -195,5 +191,6 @@ def write_healthcheck_file(self):
195191
with open(settings.HEALTHCHECK_FILE_NAME, 'w') as file:
196192
file.write(timezone.now().isoformat())
197193

198-
def _exit_called(self):
194+
def _exit_called(self, signum, frame):
195+
logger.info('[django-eb-sqs] Termination signal called: {}'.format(signum))
199196
self._exit_gracefully = True

0 commit comments

Comments
 (0)