def prepare(self): if options.max_requests and \ self.application._requests >= options.max_requests: gen_logger.warning('Too Many Request: %d', self.application._requests) self._max_requests = True raise HTTPError(429) self.application._requests += 1
def start(self, callback=None): assert options.timer_interval > 0 if callback is None: gen_logger.warning('timer callback is None') return if self.__scheduler is not None: return self.__scheduler = \ PeriodicCallback(callback, options.timer_interval * 1000) self.__scheduler.start()
def _reopen_log(sig, frame): gen_logger.warning('Catch SIG: %d, ReOpen Log', sig) setup_log()
def _handle_signal(sig, frame): gen_logger.warning('Catch SIG: %d, Gently Quit', sig) _quit()