Compare commits

..

No commits in common. "7b806075c7c70bcafbc5490c52b8de9af78ad9d1" and "2eb13d9443aaa9c5e1d2f75898f8aafeea179875" have entirely different histories.

View File

@ -10,7 +10,7 @@ class QueuesException(Exception):
class TasksHandlerMixin: class TasksHandlerMixin:
def poll(self): def poll(self):
while True: while True:
response: tasks_pb2.TakeResponse = self.stub.Take(tasks_pb2.TakeRequest(queue=self.queue_name)) response: tasks_pb2.TakeResponse = self.stub.Take(tasks_pb2.TakeRequest(self.queue_name))
task: tasks_pb2.Task = response.task task: tasks_pb2.Task = response.task
if not task: if not task:
time.sleep(0.2) time.sleep(0.2)
@ -21,7 +21,7 @@ class TasksHandlerMixin:
print(f'Error processing message id={task["id"]}, payload={task["payload"]}, exc={exc}') print(f'Error processing message id={task["id"]}, payload={task["payload"]}, exc={exc}')
continue continue
try: try:
self.stub.Finish(tasks_pb2.FinishRequest(id=task.id)) self.stub.Finish(tasks_pb2.FinishRequest(task.id))
except: except:
print(f'Failed to finish task id={task.id}') print(f'Failed to finish task id={task.id}')