fix
This commit is contained in:
parent
a4b580eab6
commit
ec2c39ed35
@ -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(self.queue_name))
|
response: tasks_pb2.TakeResponse = self.stub.Take(tasks_pb2.TakeRequest(queue=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(task.id))
|
self.stub.Finish(tasks_pb2.FinishRequest(id=task.id))
|
||||||
except:
|
except:
|
||||||
print(f'Failed to finish task id={task.id}')
|
print(f'Failed to finish task id={task.id}')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user