master #47

Merged
emmatveev merged 4 commits from master into dev 2024-12-31 02:50:32 +03:00
Showing only changes of commit f27122ce56 - Show all commits

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)