Commit 8f975107 authored by Andrey Veltischev's avatar Andrey Veltischev
Browse files

Add default handlers for TERM and HUP signals

parent 2d770a00
import asyncio
import signal
from aiohttp import web
import prometheus_client
import logging
from aiohttp.web_runner import _raise_graceful_exit
LOG = logging.getLogger('application_wrapper')
......@@ -90,6 +93,8 @@ class ApplicationWrapper:
self.loop.add_signal_handler(_signal_name, callback)
def run_all(self):
self.handle_signal(signal.SIGTERM, _raise_graceful_exit)
self.handle_signal(signal.SIGHUP, _raise_graceful_exit)
try:
LOG.info('Start serving')
exceptions = self.loop.run_until_complete(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment