Compare commits

..

No commits in common. "5102564b8446f71d144599e74af5dc64498aad5b" and "733ab721d638cae4e4e63f57f814f074449b277d" have entirely different histories.

2 changed files with 2 additions and 8 deletions

View File

@ -1,7 +1,6 @@
import telebot import telebot
import multiprocessing import multiprocessing
import time import time
import json
from daemons import base from daemons import base
from utils import platform from utils import platform
@ -42,5 +41,5 @@ class Daemon(base.Daemon):
bot = telebot.TeleBot(token) bot = telebot.TeleBot(token)
@bot.message_handler(content_types=['audio', 'photo', 'voice', 'video', 'document', 'animation', 'text', 'location', 'contact', 'sticker', 'video_note']) @bot.message_handler(content_types=['audio', 'photo', 'voice', 'video', 'document', 'animation', 'text', 'location', 'contact', 'sticker', 'video_note'])
def do_action(message: telebot.types.Message): def do_action(message: telebot.types.Message):
queues.set_task(queue, json.loads(message.json), 1) queues.set_task(queue, message.json, 1)
bot.polling() bot.polling()

View File

@ -17,12 +17,7 @@ class QueuesException(Exception):
class TasksHandlerMixin: class TasksHandlerMixin:
def poll(self): def poll(self):
while True: while True:
try: response = requests.get(f'{QUEUES_URL}/api/v1/take', headers={'queue': self.queue_name}).json()
response = requests.get(f'{QUEUES_URL}/api/v1/take', headers={'queue': self.queue_name}).json()
except requests.JSONDecodeError:
print('Unable to decode json')
time.sleep(3)
continue
task = response.get('task') task = response.get('task')
if not task: if not task:
time.sleep(0.2) time.sleep(0.2)