From afe0ddfae6ece6d1a6fa6a9ca9e4414ebc800598 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ondr=C3=A1=C4=8Dek?= Date: Tue, 2 Apr 2024 16:17:05 +0200 Subject: [PATCH] rrl: allow changing configuration on reload --- manager/knot_resolver_manager/kres_manager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manager/knot_resolver_manager/kres_manager.py b/manager/knot_resolver_manager/kres_manager.py index 072c73fc3..8cfd73c8f 100644 --- a/manager/knot_resolver_manager/kres_manager.py +++ b/manager/knot_resolver_manager/kres_manager.py @@ -2,6 +2,7 @@ import asyncio import logging import sys import time +import os from subprocess import SubprocessError from typing import Callable, List, Optional @@ -166,6 +167,12 @@ class KresManager: # pylint: disable=too-many-instance-attributes async def validate_config(self, _old: KresConfig, new: KresConfig) -> Result[NoneType, str]: async with self._manager_lock: + if _old.rate_limiting != new.rate_limiting: + logger.debug("Unlinking shared RRL memory") + try: + os.unlink(str(_old.rundir) + "/rrl") + except FileNotFoundError: + pass logger.debug("Testing the new config with a canary process") try: # technically, this has side effects of leaving a new process runnning -- 2.47.2