fix #45

Merged
emmatveev merged 1 commits from master into prod 2024-12-28 14:19:05 +03:00

View File

@ -17,10 +17,11 @@ class QueuesException(Exception):
class TasksHandlerMixin: 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}) try:
print('Got status', response.status_code) response = requests.get(f'{QUEUES_URL}/api/v1/take', headers={'queue': self.queue_name}).json()
print('Got body', response.content.decode('utf-8')) except requests.JSONDecodeError:
response = response.json() print('Unable to decode json')
continue
task = response.get('task') task = response.get('task')
if not task: if not task:
time.sleep(0.2) time.sleep(0.2)