mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-15 00:11:15 +03:00
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
This commit is contained in:
parent
45993b0061
commit
9043daa4f0
@ -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
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user