fix
This commit is contained in:
@@ -1,18 +1,3 @@
|
||||
import os
|
||||
import grpc
|
||||
from queues import tasks_pb2_grpc
|
||||
|
||||
|
||||
stage = os.getenv("STAGE", 'local')
|
||||
if stage == 'local':
|
||||
QUEUES_URL = 'localhost:50051'
|
||||
else:
|
||||
QUEUES_URL = 'queues-grpc:50051'
|
||||
|
||||
|
||||
class Daemon:
|
||||
def __init__(self):
|
||||
self.channel = grpc.insecure_channel(QUEUES_URL)
|
||||
self.stub = tasks_pb2_grpc.TasksStub(channel=self.channel)
|
||||
def execute(self):
|
||||
raise NotImplemented
|
||||
|
||||
@@ -9,7 +9,6 @@ from utils import queues
|
||||
|
||||
class Daemon(base.Daemon):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.processes: dict[str, multiprocessing.Process|None] = {}
|
||||
|
||||
def execute(self):
|
||||
@@ -42,5 +41,5 @@ class Daemon(base.Daemon):
|
||||
bot = telebot.TeleBot(token)
|
||||
@bot.message_handler(content_types=['audio', 'photo', 'voice', 'video', 'document', 'animation', 'text', 'location', 'contact', 'sticker', 'video_note'])
|
||||
def do_action(message: telebot.types.Message):
|
||||
queues.set_task(self.stub, queue, message.json, 1)
|
||||
queues.set_task(queue, message.json, 1)
|
||||
bot.polling()
|
||||
|
||||
Reference in New Issue
Block a user