frigate/frigate
Claude f528a16065
fix: clean up stale DB recording entries when file is missing on disk
When reduce_storage_consumption() encountered a FileNotFoundError
(file deleted outside Frigate), it silently skipped the recording
without removing it from the database. Over time this caused the DB
to accumulate stale entries, making "Frigate recordings tracked" in
/system#storage dramatically overstate actual disk usage.

The bug also affected cleanup behaviour: stale entries don't count
toward freed-space accounting, so Phase 2 (force-delete retained
recordings) could trigger prematurely when most old entries were stale.

Fix: always append the recording to deleted_recordings regardless of
whether the file existed, so the DB entry is removed. freed-space
accounting is unchanged — FileNotFoundError still does not increment
deleted_segments_size since no actual disk space was recovered.

Applied to both Phase 1 (non-retained) and Phase 2 (retained) loops
inside reduce_storage_consumption().

https://claude.ai/code/session_01DMdSSQhQfTuXmzPtRvJmLB
2026-03-16 04:58:47 +00:00
..
api Merge branch 'blakeblackshear:dev' into dev 2026-03-15 13:55:05 +11:00
camera Various Fixes (#22263) 2026-03-04 15:53:20 -07:00
comms Debug replay (#22212) 2026-03-04 10:07:34 -06:00
config Merge branch 'blakeblackshear:dev' into dev 2026-03-15 13:55:05 +11:00
data_processing Handle percentage as int (#22370) 2026-03-10 07:35:00 -06:00
db Improve LPR regex support (#19767) 2025-08-26 08:11:37 -05:00
detectors Initial commit for AXERA AI accelerators (#22206) 2026-03-11 06:49:28 -06:00
embeddings Refactor enrichment confg updater (#22325) 2026-03-08 14:14:18 -06:00
events Debug replay (#22212) 2026-03-04 10:07:34 -06:00
genai Handle percentage as int (#22370) 2026-03-10 07:35:00 -06:00
images Replace green screen with error message and force camera_fps to 0 (#4544) 2022-11-28 21:47:20 -06:00
jobs Fix multi-root cleanup/sync behavior and add tests 2026-03-07 10:30:46 +11:00
motion Skip motion threshold configuration (#22255) 2026-03-05 18:20:03 -06:00
object_detection [MemryX] Clean shutdown of detector process (#21035) 2025-11-25 10:25:07 -07:00
output Merge branch 'blakeblackshear:dev' into dev 2026-03-15 13:55:05 +11:00
ptz Masks and zones improvements (#22163) 2026-02-28 07:04:43 -07:00
record Fix multi-path storage: clean all paths per cycle, prevent death loop 2026-03-13 03:33:36 +00:00
review Debug replay (#22212) 2026-03-04 10:07:34 -06:00
service_manager Add metrics page for embeddings and face / license plate processing times (#15818) 2025-02-08 12:47:01 -06:00
stats Fix multi-root cleanup/sync behavior and add tests 2026-03-07 10:30:46 +11:00
test Merge branch 'blakeblackshear:dev' into dev 2026-03-15 13:55:05 +11:00
track Debug replay (#22212) 2026-03-04 10:07:34 -06:00
util Merge branch 'blakeblackshear:dev' into dev 2026-03-15 13:55:05 +11:00
__init__.py app container and config schema 2021-01-26 21:40:33 -06:00
__main__.py Handle SIGINT with forkserver (#18860) 2025-08-16 10:20:33 -05:00
app.py Fix multi-root cleanup/sync behavior and add tests 2026-03-07 10:30:46 +11:00
const.py Debug replay (#22212) 2026-03-04 10:07:34 -06:00
debug_replay.py Add ability to delete cameras (#22336) 2026-03-08 16:23:48 -06:00
ffmpeg_presets.py Miscellaneous Fixes (0.17 beta) (#21301) 2025-12-16 08:11:53 -06:00
log.py Add languages (#21870) 2026-02-03 13:29:52 -06:00
models.py Improve motion review and add motion search (#22253) 2026-03-05 17:53:48 -06:00
mypy.ini Enable mypy for track and fix typing errors (#19529) 2025-08-17 12:27:42 -05:00
plus.py Add ability to update Frigate+ model to latest from UI (#17324) 2025-03-24 09:19:58 -06:00
storage.py fix: clean up stale DB recording entries when file is missing on disk 2026-03-16 04:58:47 +00:00
timeline.py Debug replay (#22212) 2026-03-04 10:07:34 -06:00
types.py Media sync API refactor and UI (#21542) 2026-02-26 21:27:56 -07:00
video.py Add dynamic configuration for more fields (#22295) 2026-03-06 13:45:39 -07:00
watchdog.py Improve async object detector support (#17712) 2025-04-15 08:55:38 -05:00