]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
formatting fix
authorVasek Sraier <git@vakabus.cz>
Sat, 17 Jul 2021 08:10:45 +0000 (10:10 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:52 +0000 (16:17 +0200)
manager/knot_resolver_manager/kres_manager.py

index 7b818861a6b3b3adffe808d54b1f7d0366adca10..a1820a7971338993e1094214bce0341e749950a6 100644 (file)
@@ -1,7 +1,7 @@
 import asyncio
 import logging
 from subprocess import SubprocessError
-from typing import List, Optional, Type
+from typing import List, Optional, Set, Type
 from uuid import uuid4
 
 from knot_resolver_manager.constants import KRESD_CONFIG_FILE
@@ -15,6 +15,16 @@ from .datamodel import KresConfig
 logger = logging.getLogger(__name__)
 
 
+class _PrettyIDAllocator:
+    def __init__(self):
+        self._used: Set[int] = set()
+
+    def free(self, n: int):
+        assert n in self._used
+        self._used.remove(n)
+
+
+
 class KresManager:
     """
     Core of the whole operation. Orchestrates individual instances under some
@@ -76,15 +86,15 @@ class KresManager:
         # spawn new children if needed
         while len(self._workers) < n:
             await self._spawn_new_worker()
-    
+
     def _is_gc_running(self) -> bool:
         return self._gc is not None
-    
+
     async def _start_gc(self):
         subprocess = await self._controller.create_subprocess(SubprocessType.GC, "gc")
         await subprocess.start()
         self._gc = subprocess
-    
+
     async def _stop_gc(self):
         assert self._gc is not None
         await self._gc.stop()