commit
0e836b1d92
@ -19,10 +19,11 @@ class TasksHandlerMixin:
|
|||||||
def poll(self):
|
def poll(self):
|
||||||
while True:
|
while True:
|
||||||
response = requests.get(f'{QUEUES_URL}/api/v1/take', headers={'queue': self.queue_name})
|
response = requests.get(f'{QUEUES_URL}/api/v1/take', headers={'queue': self.queue_name})
|
||||||
if response.status_code == 404:
|
task = response.get('task')
|
||||||
|
if not task:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
continue
|
continue
|
||||||
data = response.json()
|
data = task.json()
|
||||||
try:
|
try:
|
||||||
self.process(data['payload'])
|
self.process(data['payload'])
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
Loading…
Reference in New Issue
Block a user