Event cleanup fixes (#25072)

* keep event cleanup running and fix storage usage keys

- Event cleanup ran with no exception handling inside its loop, so one error (a camera added or removed while it iterated the shared cameras dict, a DB error, a thumbnail unlink failure) ended event and snapshot retention until restart. Each cycle is now guarded, camera iterations use a snapshot, and thumbnail unlink errors are caught
- Camera keys were captured once at startup, so a camera added at runtime also matched the removed-camera branch and its events could expire early under the global retention. The keys are refreshed each cycle and the removed-camera label cache resets when they change
- Clip expiry had no has_clip filter and redid every past expiration each cycle. The queries now skip events already expired, and the dead clip unlink block is removed
- Storage usage was keyed by friendly name, so cameras sharing one merged into a single row. It is keyed by camera id and the storage graph resolves the display name

* docstring
This commit is contained in:
Josh Hawkins
2026-11-24 06:19:52 -07:00
committed by GitHub
parent 12da604820
commit 18bc2c6570
6 changed files with 247 additions and 90 deletions
@@ -18,6 +18,9 @@ import {
} from "@/components/ui/popover";
import { getUnitSize } from "@/utils/storageUtil";
import { CameraStorage, StreamStorage } from "@/types/stats";
import { FrigateConfig } from "@/types/frigateConfig";
import { resolveCameraName } from "@/hooks/use-camera-friendly-name";
import useSWR from "swr";
import { CiCircleAlert } from "react-icons/ci";
import { useTranslation } from "react-i18next";
@@ -51,6 +54,7 @@ export function CombinedStorageGraph({
}: CombinedStorageGraphProps) {
const { t } = useTranslation(["views/system", "components/player"]);
const { data: config } = useSWR<FrigateConfig>("config");
const { theme, systemTheme } = useTheme();
const isDark = (systemTheme || theme) == "dark";
@@ -197,10 +201,10 @@ export function CombinedStorageGraph({
} else if (name == "Other") {
return t("label.other", { ns: "common" });
} else {
return name.replaceAll("_", " ");
return resolveCameraName(config, name);
}
},
[t],
[t, config],
);
const getStreamSplit = useCallback(