diff --git a/frigate/const.py b/frigate/const.py index cf04ce7b2..183506a04 100644 --- a/frigate/const.py +++ b/frigate/const.py @@ -129,3 +129,7 @@ AUTOTRACKING_ZOOM_EDGE_THRESHOLD = 0.05 JWT_SECRET_ENV_VAR = "FRIGATE_JWT_SECRET" PASSWORD_HASH_ALGORITHM = "pbkdf2_sha256" + +# Queues + +FAST_QUEUE_TIMEOUT = 0.00001 # seconds diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py index 9f08f88a9..25783965c 100644 --- a/frigate/record/maintainer.py +++ b/frigate/record/maintainer.py @@ -27,6 +27,7 @@ from frigate.config import FrigateConfig, RetainModeEnum from frigate.const import ( CACHE_DIR, CACHE_SEGMENT_FORMAT, + FAST_QUEUE_TIMEOUT, INSERT_MANY_RECORDINGS, MAX_SEGMENT_DURATION, MAX_SEGMENTS_IN_CACHE, @@ -38,8 +39,6 @@ from frigate.util.services import get_video_properties logger = logging.getLogger(__name__) -QUEUE_READ_TIMEOUT = 0.00001 # seconds - class SegmentInfo: def __init__( @@ -536,7 +535,7 @@ class RecordingMaintainer(threading.Thread): # empty the object recordings info queue while True: (topic, data) = self.detection_subscriber.check_for_update( - timeout=QUEUE_READ_TIMEOUT + timeout=FAST_QUEUE_TIMEOUT ) if not topic: diff --git a/frigate/track/object_processing.py b/frigate/track/object_processing.py index 35bca4d5e..702df32bd 100644 --- a/frigate/track/object_processing.py +++ b/frigate/track/object_processing.py @@ -28,7 +28,7 @@ from frigate.config import ( RecordConfig, SnapshotsConfig, ) -from frigate.const import UPDATE_CAMERA_ACTIVITY +from frigate.const import FAST_QUEUE_TIMEOUT, UPDATE_CAMERA_ACTIVITY from frigate.events.types import EventStateEnum, EventTypeEnum from frigate.models import Event, Timeline from frigate.track.tracked_object import TrackedObject @@ -682,7 +682,9 @@ class TrackedObjectProcessor(threading.Thread): # cleanup event finished queue while not self.stop_event.is_set(): - update = self.event_end_subscriber.check_for_update(timeout=0.01) + update = self.event_end_subscriber.check_for_update( + timeout=FAST_QUEUE_TIMEOUT + ) if not update: break