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