clear all the queues on exit.
This commit is contained in:
parent
bc1bd45cd4
commit
d6751dc41f
1 changed files with 22 additions and 0 deletions
22
server.py
22
server.py
|
@ -329,6 +329,28 @@ class BAPSicleServer:
|
||||||
|
|
||||||
del self.player
|
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.")
|
print("Stopped all processes.")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue