Restore runtime state on startup (#23326)

* add class

* restore runtime state in dispatcher

* restore on startup with special case for profile

* add tests

* update docs

* mypy
This commit is contained in:
Josh Hawkins
2026-05-27 12:03:09 -06:00
committed by GitHub
parent 2858662be9
commit e9ef4f978a
11 changed files with 676 additions and 8 deletions
+8 -1
View File
@@ -348,7 +348,11 @@ class FrigateApp:
persisted in cam.profiles for cam in self.config.cameras.values()
):
logger.info("Restoring persisted profile '%s'", persisted)
self.profile_manager.activate_profile(persisted)
# don't clear runtime overrides here, restore_runtime_state() later
# in startup replays it on top of the activated profile
self.profile_manager.activate_profile(
persisted, clear_runtime_overrides=False
)
def start_detectors(self) -> None:
for name in self.config.cameras.keys():
@@ -612,6 +616,9 @@ class FrigateApp:
self.start_record_cleanup()
self.start_watchdog()
# restore persisted runtime overrides on top of config
self.dispatcher.restore_runtime_state()
self.init_auth()
try: