From c4f0b6c9f57dd8e21dd09ab0e538de21cea0b104 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 10 Jul 2023 18:10:51 -0600 Subject: [PATCH] Refactor queue size --- frigate/app.py | 16 ++++++++++++---- frigate/const.py | 2 +- frigate/http.py | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/frigate/app.py b/frigate/app.py index 8d863bd14..568a21e7f 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -199,8 +199,12 @@ class FrigateApp: def init_queues(self) -> None: # Queues for clip processing - self.event_queue: Queue = ff.Queue(DEFAULT_QUEUE_BUFFER_SIZE) - self.event_processed_queue: Queue = ff.Queue(DEFAULT_QUEUE_BUFFER_SIZE) + self.event_queue: Queue = ff.Queue( + DEFAULT_QUEUE_BUFFER_SIZE * len(self.config.cameras.keys()) + ) + self.event_processed_queue: Queue = ff.Queue( + DEFAULT_QUEUE_BUFFER_SIZE * len(self.config.cameras.keys()) + ) self.video_output_queue: Queue = mp.Queue( maxsize=len(self.config.cameras.keys()) * 2 ) @@ -211,10 +215,14 @@ class FrigateApp: ) # Queue for recordings info - self.recordings_info_queue: Queue = ff.Queue(DEFAULT_QUEUE_BUFFER_SIZE) + self.recordings_info_queue: Queue = ff.Queue( + DEFAULT_QUEUE_BUFFER_SIZE * len(self.config.cameras.keys()) + ) # Queue for timeline events - self.timeline_queue: Queue = ff.Queue(DEFAULT_QUEUE_BUFFER_SIZE) + self.timeline_queue: Queue = ff.Queue( + DEFAULT_QUEUE_BUFFER_SIZE * len(self.config.cameras.keys()) + ) def init_database(self) -> None: def vacuum_db(db: SqliteExtDatabase) -> None: diff --git a/frigate/const.py b/frigate/const.py index c508a83bf..c7c75c6b3 100644 --- a/frigate/const.py +++ b/frigate/const.py @@ -49,4 +49,4 @@ MAX_PLAYLIST_SECONDS = 7200 # support 2 hour segments for a single playlist to # Queue Values -DEFAULT_QUEUE_BUFFER_SIZE = 2000 * 1000 # 2MB +DEFAULT_QUEUE_BUFFER_SIZE = 1000 * 1000 # 1MB diff --git a/frigate/http.py b/frigate/http.py index 95fd25502..043679f74 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -900,7 +900,7 @@ def create_event(camera_name, label): except Exception as e: return make_response( jsonify({"success": False, "message": f"An unknown error occurred: {e}"}), - 404, + 500, ) return make_response(