def handle_sig(self, signum, frame):
signal.signal(signal.SIGINT, self.handle_sig_force)
signal.signal(signal.SIGTERM, self.handle_sig_force)
ctrl_logger.info('got signal: %s, waiting for worker pid=%s to finish...', Signals(signum).name,
self.process and self.process.pid)
# sleep to make sure worker.handle_sig above has executed if it's going to and detached handle_proxy_signal
time.sleep(0.01)
if self.process and self.process.is_alive():
ctrl_logger.debug("sending custom shutdown signal to worker in case it didn't receive the signal")
os.kill(self.process.pid, SIG_PROXY)
评论列表
文章目录