Merge pull request 'fix' (#45) from master into prod

Reviewed-on: #45
This commit is contained in:
emmatveev 2024-12-28 14:19:04 +03:00
commit 39bca8ead9

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)