diff --git a/server.py b/server.py index e3376c7..bcddc9a 100644 --- a/server.py +++ b/server.py @@ -329,6 +329,28 @@ class BAPSicleServer: del self.player + print("Deleting all queues.") + # Should speed up GC on exit a bit. + queues = [ + self.player_to_q, + self.player_from_q, + self.ui_to_q, + self.websocket_to_q, + self.controller_to_q, + self.file_to_q, + ] + for queue in queues: + if isinstance(queue, List): + for inner_queue in queue: + while not inner_queue.empty(): + inner_queue.get() + del inner_queue + elif isinstance(queue, Queue): + while not queue.empty(): + queue.get() + for queue in queues: + del queue + print("Stopped all processes.")