🚧 Initial work on retryable managers

This commit is contained in:
GeoffreyCoulaud
2023-05-31 15:22:08 +02:00
parent 743db2b747
commit 0b188136a2
6 changed files with 52 additions and 26 deletions

View File

@@ -2,14 +2,15 @@ from requests import HTTPError
from src.game import Game
from src.store.managers.async_manager import AsyncManager
from src.utils.steamgriddb import SGDBAuthError, SGDBError, SGDBHelper
from src.store.managers.steam_api_manager import SteamAPIManager
from src.utils.steamgriddb import HTTPError, SGDBAuthError, SGDBError, SGDBHelper
class SGDBManager(AsyncManager):
"""Manager in charge of downloading a game's cover from steamgriddb"""
run_after = set((SteamAPIManager,))
retryable_on = set((HTTPError,))
def final_run(self, game: Game) -> None:
try:
@@ -19,7 +20,3 @@ class SGDBManager(AsyncManager):
# If invalid auth, cancel all SGDBManager tasks
self.cancellable.cancel()
self.report_error(error)
except (HTTPError, SGDBError) as error:
# On other error, just report it
self.report_error(error)
pass