mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Fixing error in sending commands to closed process queue
This commit is contained in:
@@ -247,6 +247,7 @@ class PlayerProcess(Process):
|
||||
if self.__guild.voice_client.is_connected():
|
||||
with self.__playlistLock:
|
||||
self.__playlist.loop_off()
|
||||
self.__playlist.clear()
|
||||
|
||||
# Send a command to the main process put this to sleep
|
||||
sleepCommand = VCommands(VCommandsType.SLEEPING)
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
from enum import Enum
|
||||
from multiprocessing import Process, Queue, Lock
|
||||
from discord import TextChannel
|
||||
from Music.Playlist import Playlist
|
||||
|
||||
|
||||
class ProcessStatus(Enum):
|
||||
RUNNING = 'Running'
|
||||
SLEEPING = 'Sleeping'
|
||||
|
||||
|
||||
class ProcessInfo:
|
||||
"""
|
||||
Class to store the reference to all structures to maintain a player process
|
||||
@@ -15,10 +21,17 @@ class ProcessInfo:
|
||||
self.__playlist = playlist
|
||||
self.__lock = lock
|
||||
self.__textChannel = textChannel
|
||||
self.__status = ProcessStatus.RUNNING
|
||||
|
||||
def setProcess(self, newProcess: Process) -> None:
|
||||
self.__process = newProcess
|
||||
|
||||
def getStatus(self) -> ProcessStatus:
|
||||
return self.__status
|
||||
|
||||
def setStatus(self, status: ProcessStatus) -> None:
|
||||
self.__status = status
|
||||
|
||||
def getProcess(self) -> Process:
|
||||
return self.__process
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from Music.MessagesController import MessagesController
|
||||
from Music.Song import Song
|
||||
from Parallelism.PlayerProcess import PlayerProcess
|
||||
from Music.Playlist import Playlist
|
||||
from Parallelism.ProcessInfo import ProcessInfo
|
||||
from Parallelism.ProcessInfo import ProcessInfo, ProcessStatus
|
||||
from Parallelism.Commands import VCommands, VCommandsType
|
||||
from Music.VulkanBot import VulkanBot
|
||||
|
||||
@@ -170,6 +170,8 @@ class ProcessManager(Singleton):
|
||||
queue1.join_thread()
|
||||
queue2.close()
|
||||
queue2.join_thread()
|
||||
# Set the status of this process as sleeping, only the playlist object remains
|
||||
self.__playersProcess[guildID].setStatus(ProcessStatus.SLEEPING)
|
||||
|
||||
async def showNowPlaying(self, guildID: int, song: Song) -> None:
|
||||
messagesController = self.__playersMessages[guildID]
|
||||
|
||||
Reference in New Issue
Block a user