From f2e23afb7a7bf4a5ee72179ef3572bd2e5454dc1 Mon Sep 17 00:00:00 2001 From: elhoim Date: Sun, 30 Aug 2026 23:59:47 +0000 Subject: [PATCH] Fix TTL boundary in cache freshness check get_cached_response used 'now - cached_at > ttl_seconds', so an entry exactly at the TTL boundary was still served as fresh. This means --cache-ttl-seconds 0, the natural way to disable caching, still returned a cache hit within the same second. Changed the comparison to >= so an entry is considered expired once its age reaches the TTL. --- bin/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli.py b/bin/cli.py index 92267b1..4ead890 100644 --- a/bin/cli.py +++ b/bin/cli.py @@ -653,7 +653,7 @@ def get_cached_response( response = entry.get("response") if not isinstance(cached_at, int) or response is None: return None - if now - cached_at > ttl_seconds: + if now - cached_at >= ttl_seconds: return None return {"cached_at": cached_at, "response": response}