def execute(self, request, pool, loglevel, logfile): if not self._pool: # just take pool from first task. self._pool = pool state.task_ready(request) # immediately remove from worker state. self._buffer.put(request) if self._tref is None: # first request starts flush timer. self._tref = timer2.apply_interval(self.flush_interval * 1000, self._do_flush) if not self._count() % self.flush_every: self._do_flush()
def on_consume_ready(self, *args, **kwargs): print("INSTALLING TIMER") self.timers.append(apply_interval(self.flush_every * 1000, self.clicks.state.flush))
def install(self): self._tref = timer2.apply_interval(self.freq * 1000.0, self.capture) self._ctref = timer2.apply_interval(self.cleanup_freq * 1000.0, self.cleanup)
def on_consume_ready(self, *args, **kwargs): print("INSTALLING TIMER") self.timers.append( apply_interval(self.flush_every * 1000, self.clicks.state.flush))