forked from Github/frigate
Shutdown hang (#11793)
* intentionally handle queues during shutdown and carefully manage shutdown order * more carefully manage shutdown to avoid threadlocks * use debug for signal logging * ensure disabled cameras dont break shutdown * typo
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
import copy
|
||||
import datetime
|
||||
import logging
|
||||
import multiprocessing as mp
|
||||
import queue
|
||||
import re
|
||||
import shlex
|
||||
import urllib.parse
|
||||
@@ -337,3 +339,13 @@ def clear_and_unlink(file: Path, missing_ok: bool = True) -> None:
|
||||
pass
|
||||
|
||||
file.unlink(missing_ok=missing_ok)
|
||||
|
||||
|
||||
def empty_and_close_queue(q: mp.Queue):
|
||||
while True:
|
||||
try:
|
||||
q.get(block=True, timeout=0.5)
|
||||
except queue.Empty:
|
||||
q.close()
|
||||
q.join_thread()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user