From: Lukáš Ondráček Date: Tue, 2 Apr 2024 14:17:05 +0000 (+0200) Subject: rrl: allow changing configuration on reload X-Git-Tag: v6.0.9~1^2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fenvironments%2Fdocs-develop-rrl-8r8r8r%2Fdeployments%2F3656;p=thirdparty%2Fknot-resolver.git rrl: allow changing configuration on reload --- 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