Repository navigation
Treat a zero cache ttl as never fresh - #1
Merged
Merged
Conversation
On Windows the clock and NTFS mtimes are coarse enough that a response written a moment earlier has an age of 0, so 'age > ttl' kept serving it with ttl=0. test_stale_entries_are_refetched failed intermittently on windows-latest for this reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the intermittent failure of
test_stale_entries_are_refetchedonwindows-latest(run 36607307567, Python 3.11).Cause
_cache.read()treated an entry as stale only whenage > ttl. On Windows the clock and NTFS mtimes are coarse, so a response written milliseconds earlier has an age of0(or slightly negative), and0 > 0is false: withttl = 0the cached body was still served. The same applied to users callingset_ttl(0)on Windows, not just to the test.Fix
read()now returnsNonewheneverttl <= 0, without comparing timestamps.41 tests pass and
ruffis clean locally (macOS); the Windows jobs here are the real check.The R package is unaffected — its cache is
httr2::req_cache().🤖 Generated with Claude Code