RSS slides fetch their feed twice per rotation (is_available + render) #17

Closed
opened 2026-08-13 19:25:06 +00:00 by paulloth1 · 1 comment
paulloth1 commented 2026-08-13 19:25:06 +00:00 (Migrated from github.com)

Problem

backend/slides/rss.py's is_available() (line 166-173) and render() (line 176+) both independently call _fetch_text(url). rotation.py's _rotation_step() calls is_available() and then, if it returned True, render() on the very next line (backend/rotation.py:147-153) — so every time rotation reaches an RSS slide, the feed URL gets fetched twice in a row for the same content.

This doubles outbound request volume to every RSS feed source for no benefit — is_available() only needs to know "did this parse to at least one item", which render() re-derives from a second fetch of the same URL moments later.

Suggested fix

Either:

  • Cache the last successful fetch briefly (a few seconds) so is_available() and render() within the same rotation step share one fetch, or
  • Simplify is_available() to a cheap check (e.g. just confirm feed_url is non-empty) and let render() be the sole place that surfaces "unable to load/parse feed" — it already renders a friendly error state for both failure cases, so is_available() gating on a full fetch+parse isn't adding much value over just always attempting to show the slide.

Where

backend/slides/rss.py:166-191, called from backend/rotation.py:139-155

## Problem `backend/slides/rss.py`'s `is_available()` (line 166-173) and `render()` (line 176+) both independently call `_fetch_text(url)`. `rotation.py`'s `_rotation_step()` calls `is_available()` and then, if it returned True, `render()` on the very next line (`backend/rotation.py:147-153`) — so every time rotation reaches an RSS slide, the feed URL gets fetched twice in a row for the same content. This doubles outbound request volume to every RSS feed source for no benefit — `is_available()` only needs to know "did this parse to at least one item", which `render()` re-derives from a second fetch of the same URL moments later. ## Suggested fix Either: - Cache the last successful fetch briefly (a few seconds) so `is_available()` and `render()` within the same rotation step share one fetch, or - Simplify `is_available()` to a cheap check (e.g. just confirm `feed_url` is non-empty) and let `render()` be the sole place that surfaces "unable to load/parse feed" — it already renders a friendly error state for both failure cases, so `is_available()` gating on a full fetch+parse isn't adding much value over just always attempting to show the slide. ## Where `backend/slides/rss.py:166-191`, called from `backend/rotation.py:139-155`
paulloth1 commented 2026-08-13 19:31:07 +00:00 (Migrated from github.com)

Fixed and deployed. is_available() in backend/slides/rss.py now does a cheap non-network check (feed_url non-empty) instead of a full fetch+parse — render() already has a friendly error state for a broken feed, so the redundant fetch added no real value. RSS feed requests per rotation step now: 1 (was 2).

Fixed and deployed. `is_available()` in backend/slides/rss.py now does a cheap non-network check (feed_url non-empty) instead of a full fetch+parse — render() already has a friendly error state for a broken feed, so the redundant fetch added no real value. RSS feed requests per rotation step now: 1 (was 2).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
paul_loth/krautspaceTV#17
No description provided.