コード例 #1
0
ファイル: consumer.py プロジェクト: mSOHU/arkham
 def setup_signal_handler(self):
     def _term_handler():
         self.stop_flag = True
         if not self.worker.is_running():
             self.logger.warning('SIGTERM received. Exiting...')
         else:
             self.logger.warning(
                 'SIGTERM received while processing a message, '
                 'consumer exit is scheduled.')
     handle_term(_term_handler)
コード例 #2
0
ファイル: consumer.py プロジェクト: sdgdsffdsfff/arkham
    def setup_signal_handler(self):
        def _term_handler():
            if not self.worker.is_running():
                self.logger.warning("SIGTERM received. Exiting...")
                ioloop = self.subscriber.connection._impl

                # blocking channel's cancel will call process_timeouts,
                # and timeouts will be invoked again.
                ioloop.add_timeout(0, call_once(self.subscriber.channel.cancel))
            else:
                self.logger.warning("SIGTERM received while processing a message, consumer exit is scheduled.")
            self.stop_flag = True

        handle_term(_term_handler)