LIVE_TTL_SECONDS is defined and never read; every page load hits upstream FPL #10
Labels
No labels
architecture
cleanup
dependencies
performance
priority: high
priority: medium
reliability
security
testing
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
solvreven/FPL#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
LIVE_TTL_SECONDS = 900appears exactly once in the repository — itsown definition at
backend/web/main.py. Nothing reads it.It sits directly above
/api/refresh-live, carrying a four-line docstringexplaining why prices and availability need a shorter refresh cycle than the
~170s simulation — and the endpoint beneath it never consults it. Every call
unconditionally runs
FplClient().get_bootstrap().frontend/app.jscallsrefreshLiveFast(null, true)once, on startup. Soevery page load fetches upstream FPL, with the freshness policy written down
three lines above the endpoint and never connected.
Suggested fix. Honour the TTL server-side: if the last successful bootstrap
is younger than
LIVE_TTL_SECONDS, return the cached fetch time and a flagsaying no upstream call was made, rather than silently skipping (a caller that
cannot tell a refresh from a no-op will read stale flags as current — the exact
condition the endpoint's own docstring says it exists to end).
Retired on
fix/gw2-window-and-provenance(46d6f47, pushed just now) — removed rather than wired, because the model it belonged to is gone.A TTL is a pull design: serve stale data until someone asks and the clock says it expired.
autorefresh.Refresher(9d9bd4d) is a push design — it re-fetches bootstrap and fixtures together every 300s, atomically, and publishes the age of what it holds. "How old is this" is answered by measurement instead of by an assumption about how long an answer stays good, so there is no remaining code path that would consult a bootstrap age against a limit./api/statusnow carrieslive.age_seconds(None until the first success — never zero, which would read as "just refreshed"), pluslast_errorandconsecutive_failures.Deleted rather than commented in place: unlike a CSS fallback there is no context in which the value would apply. The comment left behind records what stood there and why it went.
This issue also noted the reload-on-every-request cost; that is addressed by the same change, since the refresher owns the cadence rather than each request re-deciding.
Closed after PR #19 merged as
6e888a5. The implementation described in the latest issue comment is now on main.