[core] Fix non-threaded metadata updates

This commit is contained in:
derrod 2021-12-08 00:44:24 +01:00
parent 6106433153
commit 57d88b2db4

View file

@ -417,8 +417,10 @@ class LegendaryCore:
game = Game(app_name=app_name, app_title=eg_meta['title'], metadata=eg_meta, asset_infos=assets[app_name]) game = Game(app_name=app_name, app_title=eg_meta['title'], metadata=eg_meta, asset_infos=assets[app_name])
self.lgd.set_game_meta(game.app_name, game) self.lgd.set_game_meta(game.app_name, game)
games[app_name] = game games[app_name] = game
still_needs_update.remove(app_name)
# setup and teardown of thread pool takes some time, so only do it when it makes sense. # setup and teardown of thread pool takes some time, so only do it when it makes sense.
still_needs_update = {e[0] for e in fetch_list}
use_threads = len(fetch_list) > 5 use_threads = len(fetch_list) > 5
if fetch_list: if fetch_list:
self.log.info(f'Fetching metadata for {len(fetch_list)} app(s).') self.log.info(f'Fetching metadata for {len(fetch_list)} app(s).')
@ -432,7 +434,7 @@ class LegendaryCore:
game = games.get(app_name) game = games.get(app_name)
# retry if metadata is still missing/threaded loading wasn't used # retry if metadata is still missing/threaded loading wasn't used
if not game: if not game or app_name in still_needs_update:
if use_threads: if use_threads:
self.log.warning(f'Fetching metadata for {app_name} failed, retrying') self.log.warning(f'Fetching metadata for {app_name} failed, retrying')
_ga = next(iter(app_assets.values())) _ga = next(iter(app_assets.values()))