Commit c3fceb0
committed
fix(config): clamp negative cache age to 0 (fresh, not stale)
The previous strict guard rejected negative
ages outright, but a negative age means the cache file was just
written (Windows mtime skew puts it slightly in the future of
time.time()). Treating it as miss broke
test_from_url_uses_cache_when_fresh on Windows.
Correct semantic: negative age = 'just written' = max(0, age) = 0
= fresh (passes the < max_age check for any positive max_age).
With max_age=0 we still get 0 < 0 = False = miss, so the
cache-bypass test still passes.1 parent c1963c3 commit c3fceb0
1 file changed
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
| 276 | + | |
278 | 277 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| |||
0 commit comments