fix(plex): E30 review round 3 — a dead headshot breaks the Plex-failing streak, 410 held by a test
This commit is contained in:
@@ -244,7 +244,8 @@ def warm_portraits(db: Session, limit: int) -> dict:
|
||||
).tuples()
|
||||
if thumb
|
||||
}
|
||||
done = dead = plex_failed = down = 0 # `down` counts in a row, `plex_failed` in all
|
||||
# `down` counts Plex failing in a row (any answer from Plex breaks it), `plex_failed` in all
|
||||
done = dead = plex_failed = down = 0
|
||||
with plex:
|
||||
for pid in people_by_credits(db, "portrait", None):
|
||||
if done + dead >= limit or down >= _PLEX_DOWN_AFTER:
|
||||
@@ -264,7 +265,7 @@ def warm_portraits(db: Session, limit: int) -> dict:
|
||||
# Plex failing, which must neither mark the file nor keep the run going.
|
||||
cause = exc.__cause__
|
||||
if isinstance(cause, httpx.HTTPStatusError) and cause.response.status_code in _DEAD:
|
||||
dead += 1
|
||||
dead, down = dead + 1, 0 # Plex answered: it is up, the streak is broken
|
||||
imgcache.mark_miss(key)
|
||||
else:
|
||||
plex_failed, down = plex_failed + 1, down + 1
|
||||
|
||||
Reference in New Issue
Block a user