Conversation
follows the same cleanup path
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.
Fixed several bugs related to miss counting, missing await, lock cleanup on exceptions, and cancellation handling.
What was fixed
Miss counter when lock is disabled
With
lock=False, misses were never incremented and hits were double-counted. Now they are counted correctly.Missing await on the ignore path
In the async wrapper, when
cachebox__ignore=Trueand lock was off, the function was not awaited and a coroutine object was returned. Now it is properly awaited.Lock leak when the function raises
If the cached function raised an exception, the per-key lock was never removed and stayed in memory. It is now cleaned up properly.
Waiters not decremented on cancellation
If a task was cancelled while waiting for the lock, the waiter count stayed high and the lock was never cleaned up. Now it is decremented with try/finally.
BaseException handling
All exceptions now go through the same cleanup path (previously only
Exceptions was caught).Frozen validation
The check for the underlying cache no longer relies on
assert(so it still works with-O).make_key
Removed an unreachable branch.