diff --git a/frigate/app.py b/frigate/app.py index b2402d2326..785dc24470 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -343,13 +343,21 @@ class FrigateApp: ) 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() if persisted and any( persisted in cam.profiles for cam in self.config.cameras.values() ): logger.info("Restoring persisted profile '%s'", persisted) - # don't clear runtime overrides here, restore_runtime_state() later - # in startup replays it on top of the activated profile + # runtime overrides are layered on top via restore_runtime_state() self.profile_manager.activate_profile( persisted, clear_runtime_overrides=False ) @@ -617,6 +625,7 @@ class FrigateApp: self.start_watchdog() # restore persisted runtime overrides on top of config + self.restore_active_profile() self.dispatcher.restore_runtime_state() self.init_auth()