]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: run policy-loader with old config when instability detected
authorAleš Mrázek <ales.mrazek@nic.cz>
Wed, 26 Jun 2024 04:38:41 +0000 (06:38 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Mon, 8 Jul 2024 11:42:09 +0000 (11:42 +0000)
manager/knot_resolver_manager/kres_manager.py

index b22570ed50726fc40c7e03db2caa11c9be860068..81aa7d7e97fe8debff47dd3f4be5021a5f24c328 100644 (file)
@@ -327,7 +327,7 @@ class KresManager:  # pylint: disable=too-many-instance-attributes
     async def _instability_handler(self) -> None:
         if self._fix_counter.is_too_high():
             logger.error(
-                "Already attempted to many times to fix system state. Refusing to try again and shutting down."
+                "Already attempted too many times to fix system state. Refusing to try again and shutting down."
             )
             await self.forced_shutdown()
             return
@@ -337,7 +337,9 @@ class KresManager:  # pylint: disable=too-many-instance-attributes
             self._fix_counter.increase()
             await self._reload_system_state()
             logger.warning("Workers reloaded. Applying old config....")
-            await self.apply_config(self._config_store.get(), _noretry=True)
+            old_config = self._config_store.get()
+            await self.load_policy_rules(old_config, old_config)
+            await self.apply_config(old_config, _noretry=True)
             logger.warning(f"System stability hopefully renewed. Fix attempt counter is currently {self._fix_counter}")
         except BaseException:
             logger.error("Failed attempting to fix an error. Forcefully shutting down.", exc_info=True)