mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Fixing error when stop and return too fast, because of that there may be some threads downloading songs that will try to put songs in a already closed queue
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from Parallelism.Commands import VCommands
|
||||
from multiprocessing import Queue
|
||||
from typing import List, Union
|
||||
from discord.ext.commands import Context
|
||||
from discord import Client, Guild, ClientUser, Interaction, Member, User
|
||||
@@ -27,6 +29,12 @@ class AbstractHandler(ABC):
|
||||
else:
|
||||
self.__author = ctx.user
|
||||
|
||||
def putCommandInQueue(self, queue: Queue, command: VCommands) -> None:
|
||||
try:
|
||||
queue.put(command)
|
||||
except Exception as e:
|
||||
print(f'[ERROR PUTTING COMMAND IN QUEUE] -> {e}')
|
||||
|
||||
@abstractmethod
|
||||
async def run(self) -> HandlerResponse:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user