]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
python datamodel: tweak cache TTL validation
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 16 Sep 2024 15:10:29 +0000 (17:10 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 16 Sep 2024 15:10:29 +0000 (17:10 +0200)
I'm not aware of a use case for the limits to be equal,
but it's at least a sane combination.

python/knot_resolver/datamodel/cache_schema.py

index c78d831ef751a4281f788202e814741e05926992..3f7d1dc22fc152d8d0787cfbd76d1957b4bd3beb 100644 (file)
@@ -133,5 +133,5 @@ class CacheSchema(ConfigSchema):
     prefetch: PrefetchSchema = PrefetchSchema()
 
     def _validate(self):
-        if self.ttl_min.seconds() >= self.ttl_max.seconds():
-            raise ValueError("'ttl-max' must be larger then 'ttl-min'")
+        if self.ttl_min.seconds() > self.ttl_max.seconds():
+            raise ValueError("'ttl-max' can't be smaller than 'ttl-min'")