fix(cache): keep expiration cleanup running - #968
Open
saksim wants to merge 1 commit into
Open
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
ExpiringLocalCache deletes dictionary entries while iterating over them. The first expired entry raises RuntimeError and terminates the background cleanup task. Collecting expired keys before deletion keeps the task alive and removes every expired item; get and keys now agree that a value is expired at its deadline.
This PR only addresses expiration cleanup. It introduces no dependency or cache format change.
Validation: all 3 regression cases fail on the original implementation. The isolated branch based on upstream main d6f7c5b passes the complete tests/ suite (99 tests, Python 3.11, Windows with PYTHONUTF8=1). Tests cover task survival, multiple expired entries, live entries, and get/keys at the exact deadline. No external service is involved. The same fix passes the four Quality checks in fork PR #17.
Related report: saksim#10.