def work(self): while True: fetch.wait(self.timeout) if shutting_down.is_set(): log.info("Stop fetch worker") break self.fetch()
def run(self): while True: fetch.wait(self.timeout) if shutting_down.is_set(): log.info("Stop fetch worker") break self.fetch()
def work(self): while True: timeout = self.timeout if idle.is_set(): timeout = self.idle_timeout fetch.wait(timeout) if shutting_down.is_set(): log.info("Stop fetch worker") break self.fetch()
def work(self): while True: timeout = self.timeout if idle.is_set(): timeout = self.idle_timeout log.debug("Wait for {}".format(timeout)) fetch.wait(timeout) if shutting_down.is_set(): log.info("Stop fetch worker") break self.fetch()
def run(self): while True: if shutting_down.is_set(): log.info("Stop sync worker") break try: job = self.commit_queue.get(timeout=self.timeout, block=True) if job['type'] == 'commit': self.commits.append(job) log.debug("Got a commit job") except Empty: log.debug("Nothing to do right now, going idle") self.on_idle()
def work(self): while True: if shutting_down.is_set(): log.info("Stop sync worker") break try: job = self.commit_queue.get(timeout=self.timeout, block=True) if job['type'] == 'commit': self.commits.append(job) log.debug("Got a commit job") except Empty: log.debug("Nothing to do right now, going idle") self.on_idle()
def work(self): idle_times = 0 while True: if shutting_down.is_set(): log.info("Stop sync worker") break try: job = self.commit_queue.get(timeout=self.timeout, block=True) if job['type'] == 'commit': self.commits.append(job) log.debug("Got a commit job") idle_times = 0 idle.clear() except Empty: log.debug("Nothing to do right now, going idle") if idle_times > self.min_idle_times: idle.set() idle_times += 1 self.on_idle()
def work(self): idle_times = 0 while True: if shutting_down.is_set(): log.info("Stop sync worker") break try: job = self.commit_queue.get(timeout=self.timeout, block=True) if job["type"] == "commit": self.commits.append(job) log.debug("Got a commit job") idle_times = 0 idle.clear() except Empty: log.debug("Nothing to do right now, going idle") if idle_times > self.min_idle_times: idle.set() idle_times += 1 self.on_idle()