fix user rating refresh if a user is unavailable

If a user's ratings cannot be accessed, e.g. due to network errors, it
should skip to the next user.
Ideally we could mark a user as inactive after X failed retries.
This commit is contained in:
ducklet 2021-11-02 14:14:32 +01:00
parent 52c08f0fd8
commit dd3d5f3670

View file

@ -44,13 +44,17 @@ async def refresh_user_ratings_from_imdb(stop_on_dupe=True):
log.info("⚡️ Loading data for %s ...", user.name) log.info("⚡️ Loading data for %s ...", user.name)
async for rating, is_updated in load_ratings(user.imdb_id): try:
assert rating.user.id == user.id async for rating, is_updated in load_ratings(user.imdb_id):
assert rating.user.id == user.id
if stop_on_dupe and not is_updated: if stop_on_dupe and not is_updated:
break break
yield rating yield rating
except BaseException as err:
log.error("❌ Could not load rating for %s!", user.name, exc_info=err)
def user_ratings_url(user_id): def user_ratings_url(user_id):