]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: datamodel: cache GC config moved to cache section
authorAleš Mrázek <ales.mrazek@nic.cz>
Fri, 29 Apr 2022 14:35:25 +0000 (16:35 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 29 Apr 2022 14:42:16 +0000 (16:42 +0200)
manager/knot_resolver_manager/datamodel/cache_schema.py
manager/knot_resolver_manager/datamodel/server_schema.py
manager/knot_resolver_manager/kres_manager.py

index bb99ce4102c9d9a8e3870e942ce8c732bafa397c..87901433365cd4f08810e1d8b39d41195199aafa 100644 (file)
@@ -30,6 +30,7 @@ class CacheSchema(SchemaNode):
     DNS resolver cache configuration.
 
     ---
+    garbage_collector: Automatically use garbage collector to periodically clear cache.
     storage: Cache storage of the DNS resolver.
     size_max: Maximum size of the cache.
     ttl_min: Minimum time-to-live for the cache entries.
@@ -38,6 +39,7 @@ class CacheSchema(SchemaNode):
     prefill: Prefill the cache periodically by importing zone data obtained over HTTP.
     """
 
+    garbage_collector: bool = True
     storage: CheckedPath = CheckedPath("/var/cache/knot-resolver")
     size_max: SizeUnit = SizeUnit("100M")
     ttl_min: TimeUnit = TimeUnit("5s")
index a77e6bf3ffbc64080857c7e663cd0a4e09dc951c..563e9af6ee800ac1cbf8e4f1ee5cc5a0800ff41c 100644 (file)
@@ -105,7 +105,6 @@ class ServerSchema(SchemaNode):
         hostname: Internal DNS resolver hostname. Default is machine hostname.
         nsid: Name Server Identifier (RFC 5001) which allows DNS clients to request resolver to send back its NSID along with the reply to a DNS request.
         workers: The number of running kresd (Knot Resolver daemon) workers. If set to 'auto', it is equal to number of CPUs available.
-        use_cache_gc: Use (start) kres-cache-gc (cache garbage collector) automatically.
         backend: Forces the manager to use a specific service supervisor.
         watchdog: Disable systemd watchdog, enable with defaults or set new configuration. Can only be used with 'systemd' backend.
         rundir: Directory where the resolver can create files and which will be it's cwd.
@@ -117,7 +116,6 @@ class ServerSchema(SchemaNode):
         hostname: Optional[str] = None
         nsid: Optional[str] = None
         workers: Union[Literal["auto"], IntPositive] = IntPositive(1)
-        use_cache_gc: bool = True
         backend: BackendEnum = "auto"
         watchdog: Union[bool, WatchDogSchema] = True
         rundir: UncheckedPath = UncheckedPath(".")
@@ -130,7 +128,6 @@ class ServerSchema(SchemaNode):
     hostname: str
     nsid: Optional[str]
     workers: IntPositive
-    use_cache_gc: bool
     backend: BackendEnum = "auto"
     watchdog: Union[bool, WatchDogSchema]
     rundir: UncheckedPath = UncheckedPath(".")
index b444fa9969e08516a89cae7aa299fc21ad0e8a85..f770b6522f153572bb0e3363a6e3696b10b5e36e 100644 (file)
@@ -185,8 +185,8 @@ class KresManager:  # pylint: disable=too-many-instance-attributes
                 await self._ensure_number_of_children(config, int(config.server.workers))
                 await self._rolling_restart(config)
 
-                if self._is_gc_running() != config.server.use_cache_gc:
-                    if config.server.use_cache_gc:
+                if self._is_gc_running() != config.cache.garbage_collector:
+                    if config.cache.garbage_collector:
                         logger.debug("Starting cache GC")
                         await self._start_gc(config)
                     else: