mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-24 13:21:52 +03:00
|
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
* perf(util): use monotonic clock and bounded deque in EventsPerSecond EventsPerSecond is updated on every captured frame, every detection and every processed frame across all cameras and detectors. The previous implementation derived timestamps from datetime.now().timestamp() (wall clock), so an NTP or manual clock adjustment could skew the rolling-window expiry; it also stored timestamps in a list and expired them with del self._timestamps[0] (O(n) per removal) plus a periodic slice-copy to cap growth. Switch to time.monotonic() for the interval math (correct by construction and immune to wall-clock jumps) and a collections.deque(maxlen=...) so expiry is O(1) (popleft) and retention is bounded automatically. This mirrors the deque-based expiry already used in video/ffmpeg.py and watchdog.py. Observable output is unchanged. Adds frigate/test/test_builtin.py covering rate calculation, window expiry and the memory bound. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test: drop test_timestamps_are_memory_bounded It only asserted that deque(maxlen=) caps length, which is stdlib behavior rather than something this change needs to verify. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| audio.py | ||
| builtin.py | ||
| camera_cleanup.py | ||
| classification.py | ||
| config.py | ||
| downloader.py | ||
| ffmpeg.py | ||
| file.py | ||
| image.py | ||
| media.py | ||
| model.py | ||
| object.py | ||
| process.py | ||
| rknn_converter.py | ||
| schema.py | ||
| services.py | ||
| time.py | ||
| velocity.py | ||