fix(r5): address the fourth /code-review high round — 6 findings

- Feed memoizes onClose (like Playlists already did): the inline closure re-ran
  PlayerModal's keydown effect on every Feed render, which since the debounce
  landed also flushed the volume write and re-stole focus
- the player reads its volume with readAccountMerged again — a partial stored
  object made the level undefined -> NaN -> a persisted null; applyVolume also
  refuses a non-finite level outright
- that read moved into a lazy useState initializer (was running per render)
- the two RSS except branches share one tail, so a counter can't drift again
- run_ffmpeg tests cover the SIGTERM->SIGKILL escalation and the lingering-
  process path; dropped an assertion that only restated the fixture
- storage.ts documents the actual { volume } shape (0 IS muted)
This commit is contained in:
2026-07-24 00:45:42 +02:00
parent c0db80d333
commit fc82c8b47a
5 changed files with 70 additions and 28 deletions
+17 -19
View File
@@ -74,28 +74,26 @@ def run_rss_poll(db: Session, channels: list[Channel] | None = None) -> dict[str
channel = futures[fut]
try:
entries = fut.result()
except RssError as exc:
except Exception as exc:
# A failed poll is NOT an empty feed: skip the apply so `last_rss_at` stays where
# it was. Stamping it here made a permanently-broken feed look freshly polled.
log.warning("RSS poll skipped for channel %s: %s", channel.id, exc)
# An RssError is an EXPECTED outcome (404, timeout) → one warning line; anything
# else is a bug on our side and earns a traceback.
if isinstance(exc, RssError):
log.warning("RSS poll skipped for channel %s: %s", channel.id, exc)
else:
log.exception("RSS fetch failed for channel %s", channel.id)
failed += 1
done += 1
progress.report(done, total, "rss_poll")
continue
except Exception:
log.exception("RSS fetch failed for channel %s", channel.id)
failed += 1
done += 1
progress.report(done, total, "rss_poll")
continue
try:
new += apply_rss_feed(db, channel, entries)
except Exception:
# A write failure (read-only DB, failover) leaves the channel just as un-polled as
# an unreachable feed — count it, or a wholly broken run still reports "failed=0".
db.rollback()
failed += 1
log.exception("RSS apply failed for channel %s", channel.id)
else:
try:
new += apply_rss_feed(db, channel, entries)
except Exception:
# A write failure (read-only DB, failover) leaves the channel just as un-polled
# as an unreachable feed — count it, or a wholly broken run reports "failed=0".
db.rollback()
failed += 1
log.exception("RSS apply failed for channel %s", channel.id)
# One place that advances the counter, whatever happened above.
done += 1
progress.report(done, total, "rss_poll")
if failed: