From 3a41ff8d0cbfd0a7891697acf162f0b5800550ce Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 18:26:03 -1000 Subject: Keep a scan with a negative ttl for good "The cache" promises that a negative ttl never expires, but no age was ever below a negative cache-scan-ttl, so every request started a background rescan. --- source/cgit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/cgit.c b/source/cgit.c index 254062f..41bbad3 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -452,8 +452,9 @@ static void process_cached_repolist(const char *path) config_file_parse(cached_rc.buf, apply_config); + // A negative ttl never expires, the same as for a cached page. age = time(NULL) - st.st_mtime; - if (age <= (ctx.cfg.cache_scan_ttl * 60)) + if (ctx.cfg.cache_scan_ttl < 0 || age <= (ctx.cfg.cache_scan_ttl * 60)) goto out; // The list just parsed is stale but usable, so a child rebuilds it -- cgit 2.12.1