Repository navigation
fix: catch unhandled errors when updating cache-hit metadata (#535) - #542
Open
mehmetbahadirgungor wants to merge 1 commit into
Open
mehmetbahadirgungor wants to merge 1 commit into
mehmetbahadirgungor wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
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.
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
Bug fix
When a cached file is retrieved,
CacheStorefires an unawaited future to update cache-hit metadata without observing errors. If SQLite fails during this write (e.g. SQLite error 14 / unable to open database file), the error escapes as an unhandled asynchronous exception, even though a valid cached file is present on disk. In addition, errors during database retrieval or timer-scheduled cleanup could escape or leave pending futures uncompleted.🆕 What is the new behavior (if this is a feature change)?
Errors from the cache-hit metadata update and scheduled cleanup are observed and logged via
cacheLoggerat warning level, preventing unhandled asynchronous exceptions while still returning the cached file. Pending retrieval futures also handle errors cleanly and clean up the future cache.💥 Does this PR introduce a breaking change?
No
🐛 Recommendations for testing
Run
flutter test test/cache_store_test.dartandflutter test. Unit tests verify thatgetFilereturnsFileInfowithout unhandled errors when the database update fails on a cache hit, and that retrieval errors clean up pending cache.📝 Links to relevant issues/docs
Fixes #535
🤔 Checklist before submitting