Preprocess metadata cache if non-existing (issue #2246) #2249
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.
Short summary
This aims to fix #2246
Forcefully deleting the cache will create an odd situation where the app loads the main banner and disappears after a few seconds (probably when the caches have been loaded in the worker thread), leaving the main window in an odd incomplete state.
This change looks up in the
FlatpakBackend.vala
constructor for the user and system cache metadata folders and will recreate them (viapreprocess_metadata
) if they are not found.This will incur in a load time penalty. I believe this is not much of a big deal since this only happen if you explicitly delete the cache folders, which should be a rare occurrence in general.
Tests
Same procedure as set in the bug:
~/.cache
the foldersio.elementary.appcenter
,flatpak
andappstream
(you can also simply delete the~/.cache
folder itself.This fix should show the banner and recently updated icons without issue.
Additional info
I believe this is probably the least expensive and more complete solution. There might be a case for just letting the main banner stand and do nothing... but I'm not sure about that. You'd expect all the times to have a fully loaded presentation in the main window, no matter if it's the first time or if you have cleaned your cache.