fix: invalidate download cache after backup restore#3096
Open
leodyversemilla07 wants to merge 1 commit intomihonapp:mainfrom
Open
fix: invalidate download cache after backup restore#3096leodyversemilla07 wants to merge 1 commit intomihonapp:mainfrom
leodyversemilla07 wants to merge 1 commit intomihonapp:mainfrom
Conversation
Fixes downloads showing as 'not downloaded' after backup restore even when files exist on disk. The download cache was not being rebuilt after backup restoration, causing it to be out of sync with the actual downloaded files in storage. This led to: - All chapters showing as 'not downloaded' in the UI - Errors when trying to download already-downloaded chapters - Users having to manually invalidate cache via Advanced Settings After restoring library entries, the download cache is now automatically invalidated, triggering a rescan of the downloads directory to rebuild the cache. This ensures the UI accurately reflects which chapters are actually downloaded. Fixes mihonapp#2574
7d08212 to
913e934
Compare
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.
Summary
Fixes #2574
Automatically invalidate the download cache after backup restore to ensure the UI correctly reflects which chapters are actually downloaded.
Root Cause
When a backup is restored, the download cache is not rebuilt. This causes:
The download cache maintains an in-memory mapping of downloaded chapters. After backup restore, the cache remains empty even though downloaded files exist in storage, causing it to be out of sync with reality.
Changes
Testing
Related
This is similar to how the cache is automatically invalidated when storage location changes (see \DownloadCache.kt:131)