Cleanup queues more reliably

This commit is contained in:
Matthew Stratford 2022-03-12 16:40:05 +00:00
parent 1e77f337b1
commit 873fd45e51

View file

@ -332,7 +332,7 @@ class BAPSicleServer:
for player in self.player: for player in self.player:
player.join(timeout=PROCESS_KILL_TIMEOUT_S) player.join(timeout=PROCESS_KILL_TIMEOUT_S)
del self.player #del self.player
print("Deleting all queues.") print("Deleting all queues.")
# Should speed up GC on exit a bit. # Should speed up GC on exit a bit.
@ -345,16 +345,15 @@ class BAPSicleServer:
self.file_to_q, self.file_to_q,
] ]
for queue in queues: for queue in queues:
print(str(queue))
if isinstance(queue, List): if isinstance(queue, List):
for inner_queue in queue: for inner_queue in queue:
while not inner_queue.empty(): inner_queue.close()
inner_queue.get() #del inner_queue
del inner_queue
elif isinstance(queue, Queue): elif isinstance(queue, Queue):
while not queue.empty(): queue.close()
queue.get() print("del", str(queue))
for queue in queues: #del queue
del queue
print("Stopped all processes.") print("Stopped all processes.")