From 9043daa4f05ab8aa431dfc1b49475e9bdb22b57b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 6 Apr 2026 07:56:43 -0500 Subject: [PATCH] prune expired reconnect timestamps periodically in watchdog loop reconnect timestamps were only pruned when a new reconnect occurred. This meant a single reconnect would persist in the count indefinitely instead of expiring after 1 hour --- frigate/video/ffmpeg.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frigate/video/ffmpeg.py b/frigate/video/ffmpeg.py index 852ea4a164..860693f64e 100644 --- a/frigate/video/ffmpeg.py +++ b/frigate/video/ffmpeg.py @@ -471,8 +471,17 @@ class CameraWatchdog(threading.Thread): p["cmd"], self.logger, p["logpipe"], ffmpeg_process=p["process"] ) - # Update stall metrics based on last processed frame timestamp + # Prune expired reconnect timestamps now = datetime.now().timestamp() + while ( + self.reconnect_timestamps + and self.reconnect_timestamps[0] < now - 3600 + ): + self.reconnect_timestamps.popleft() + if self.reconnects: + self.reconnects.value = len(self.reconnect_timestamps) + + # Update stall metrics based on last processed frame timestamp processed_ts = ( float(self.detection_frame.value) if self.detection_frame else 0.0 )