mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-06 20:11:15 +03:00
defer profile restoration until subscribers are connected
This commit is contained in:
parent
d3519933a1
commit
f6b844b6e3
@ -343,13 +343,21 @@ class FrigateApp:
|
|||||||
)
|
)
|
||||||
self.dispatcher.profile_manager = self.profile_manager
|
self.dispatcher.profile_manager = self.profile_manager
|
||||||
|
|
||||||
|
def restore_active_profile(self) -> None:
|
||||||
|
"""Re-activate the persisted profile after subscribers are connected.
|
||||||
|
|
||||||
|
ZMQ PUB/SUB drops messages with no subscribers, so activation must
|
||||||
|
run after every config_updater subscriber is up.
|
||||||
|
"""
|
||||||
|
if self.profile_manager is None:
|
||||||
|
return
|
||||||
|
|
||||||
persisted = ProfileManager.load_persisted_profile()
|
persisted = ProfileManager.load_persisted_profile()
|
||||||
if persisted and any(
|
if persisted and any(
|
||||||
persisted in cam.profiles for cam in self.config.cameras.values()
|
persisted in cam.profiles for cam in self.config.cameras.values()
|
||||||
):
|
):
|
||||||
logger.info("Restoring persisted profile '%s'", persisted)
|
logger.info("Restoring persisted profile '%s'", persisted)
|
||||||
# don't clear runtime overrides here, restore_runtime_state() later
|
# runtime overrides are layered on top via restore_runtime_state()
|
||||||
# in startup replays it on top of the activated profile
|
|
||||||
self.profile_manager.activate_profile(
|
self.profile_manager.activate_profile(
|
||||||
persisted, clear_runtime_overrides=False
|
persisted, clear_runtime_overrides=False
|
||||||
)
|
)
|
||||||
@ -617,6 +625,7 @@ class FrigateApp:
|
|||||||
self.start_watchdog()
|
self.start_watchdog()
|
||||||
|
|
||||||
# restore persisted runtime overrides on top of config
|
# restore persisted runtime overrides on top of config
|
||||||
|
self.restore_active_profile()
|
||||||
self.dispatcher.restore_runtime_state()
|
self.dispatcher.restore_runtime_state()
|
||||||
|
|
||||||
self.init_auth()
|
self.init_auth()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user