Window is no longer a fiber, should prevent window from locking up due to a fiber not yielding, replaced ui's direct async calls with BackgroundWorker.foreground_job, show pulsing circle behind app logo on boot

This commit is contained in:
2022-02-12 08:47:48 -06:00
parent 202966fd08
commit 232ed2032f
11 changed files with 236 additions and 153 deletions

View File

@@ -171,23 +171,20 @@ class W3DHub
title I18n.t(:"games.fetching_news"), padding: 8
end
Async do
fetch_game_news(game)
populate_game_news(game)
end
BackgroundWorker.foreground_job(-> { fetch_game_news(game) }, ->(result) { populate_game_news(game) })
end
end
def fetch_game_news(game)
news = Api.news(game.id)
if news
news.items[0..9].each do |item|
Cache.fetch(item.image)
end
return unless news
@game_news[game.id] = news
news.items[0..9].each do |item|
Cache.fetch(item.image)
end
@game_news[game.id] = news
end
def populate_game_news(game)