def push(self, data, queue=None): queue = queue or self.input_queue retry_limit = self.retry_limit client = self.client for i in range(retry_limit): result = client.set(queue, data) if result: return result raise RetryLimitExceeded()
def run(self): queue = self.queue client = self.client retry_limit = self.retry_limit for data in self.generator: result = False for i in range(retry_limit): result = client.set(queue, data) if result: break if not result: raise RetryLimitExceeded()