]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
rrl: allow changing configuration on reload docs-develop-rrl-8r8r8r/deployments/3656
authorLukáš Ondráček <lukas.ondracek@nic.cz>
Tue, 2 Apr 2024 14:17:05 +0000 (16:17 +0200)
committerLukáš Ondráček <lukas.ondracek@nic.cz>
Tue, 2 Apr 2024 14:17:05 +0000 (16:17 +0200)
manager/knot_resolver_manager/kres_manager.py

index 072c73fc31ff1075147587c9b744233712a92aee..8cfd73c8febc5f21b1094e71b09767b56f8121f3 100644 (file)
@@ -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