mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
fix log timeout
This commit is contained in:
parent
f7021eec4c
commit
8f8054a299
@ -2,6 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import signal
|
import signal
|
||||||
|
import queue
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from logging import handlers
|
from logging import handlers
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ def root_configurer(queue):
|
|||||||
root.addHandler(h)
|
root.addHandler(h)
|
||||||
root.setLevel(logging.INFO)
|
root.setLevel(logging.INFO)
|
||||||
|
|
||||||
def log_process(queue):
|
def log_process(log_queue):
|
||||||
stop_event = mp.Event()
|
stop_event = mp.Event()
|
||||||
def receiveSignal(signalNumber, frame):
|
def receiveSignal(signalNumber, frame):
|
||||||
stop_event.set()
|
stop_event.set()
|
||||||
@ -31,10 +32,10 @@ def log_process(queue):
|
|||||||
threading.current_thread().name = f"logger"
|
threading.current_thread().name = f"logger"
|
||||||
listener_configurer()
|
listener_configurer()
|
||||||
while True:
|
while True:
|
||||||
if stop_event.is_set() and queue.empty():
|
if stop_event.is_set() and log_queue.empty():
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
record = queue.get(timeout=5)
|
record = log_queue.get(timeout=5)
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
continue
|
continue
|
||||||
logger = logging.getLogger(record.name)
|
logger = logging.getLogger(record.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user