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:
parent
52c08f0fd8
commit
dd3d5f3670
1 changed files with 9 additions and 5 deletions
|
|
@ -44,13 +44,17 @@ async def refresh_user_ratings_from_imdb(stop_on_dupe=True):
|
|||
|
||||
log.info("⚡️ Loading data for %s ...", user.name)
|
||||
|
||||
async for rating, is_updated in load_ratings(user.imdb_id):
|
||||
assert rating.user.id == user.id
|
||||
try:
|
||||
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:
|
||||
break
|
||||
if stop_on_dupe and not is_updated:
|
||||
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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue