<filename>src/trackme/killer.py<gh_stars>0
import logging
import signal


logger = logging.getLogger(__name__)


class GracefulKiller:

    kill_now = False

    def __init__(self):
        signal.signal(signal.SIGINT, self.exit_gracefully)
        signal.signal(signal.SIGTERM, self.exit_gracefully)

    def exit_gracefully(self, signum, frame):
        logger.debug('Got signal: %s', signum)
        self.kill_now = True

<filename>src/trackme/killer.py<gh_stars>0
import logging
import signal


logger = logging.getLogger(__name__)


class GracefulKiller:

    kill_now = False

    def __init__(self):
        signal.signal(signal.SIGINT, self.exit_gracefully)
        signal.signal(signal.SIGTERM, self.exit_gracefully)

    def exit_gracefully(self, signum, frame):
        logger.debug('Got signal: %s', signum)
        self.kill_now = True
