Fixed race condition where images for user avatar or news icons were not blocking execution until after they were downloaded causing a possible crash due to trying to save and load at the same time (sometimes also causing images to be only partly saved making them corrupt causing another crash)

This commit is contained in:
2022-03-20 13:51:42 -05:00
parent 76ca7e369f
commit 8766ed7d86
5 changed files with 11 additions and 8 deletions

View File

@@ -46,7 +46,7 @@ class W3DHub
Store.settings[:account][:data] = account
Store.settings.save_settings
Cache.fetch(account.avatar_uri, true) if account
Cache.fetch(account.avatar_uri, force_fetch: true, async: false) if account
applications = Api.applications if account
end
@@ -81,7 +81,7 @@ class W3DHub
if Store.account
BackgroundWorker.foreground_job(
-> { Cache.fetch(Store.account.avatar_uri) },
-> { Cache.fetch(uri: Store.account.avatar_uri, async: false) },
->(result) {
populate_account_info
page(W3DHub::Pages::Games)