Revisit rail landing data flow and freshness #1

Open
opened 2026-10-27 01:18:40 -04:00 by clatis · 0 comments
Owner

Watching trains in person, the rail landing page left me wondering: what is actually updating, and when? I assumed a poll every 10 seconds meant fresh data every 10 seconds.

The browser still polls every 10s, but the server uses a 9s cache and normally returns the expired snapshot while fetching its replacement in the background. That replacement arrives on a later poll. Live checks showed responses already about 10s old, aging further on screen—not a fixed 18s delay or a guarantee that every response is 9s+ old, but avoidable lag in the normal polling flow.

One concrete requirement: undo that stale-cache design. Once the cache expires, return refreshed data rather than the expired snapshot that triggered the refresh.

Beyond that, revisit the rail landing data flow with fresh eyes. Cleanup, refactoring, or a rewrite are all fair game; no prescribed architecture. The goal is a page that makes sense while you are actually watching the trains.

Starting points: src/rail/api.ts and src/views/pages/rail/{client.ts,index.tsx}. “Live” currently means recently fetched from MARTA, not recently observed by MARTA, and rail ETAs only change on poll responses. GitHub PR #96 fixed stale reopening behavior but retained this polling design.

Watching trains in person, the rail landing page left me wondering: what is actually updating, and when? I assumed a poll every 10 seconds meant fresh data every 10 seconds. The browser still polls every 10s, but the server uses a 9s cache and normally returns the expired snapshot while fetching its replacement in the background. That replacement arrives on a later poll. Live checks showed responses already about 10s old, aging further on screen—not a fixed 18s delay or a guarantee that every response is 9s+ old, but avoidable lag in the normal polling flow. **One concrete requirement: undo that stale-cache design. Once the cache expires, return refreshed data rather than the expired snapshot that triggered the refresh.** Beyond that, revisit the rail landing data flow with fresh eyes. Cleanup, refactoring, or a rewrite are all fair game; no prescribed architecture. The goal is a page that makes sense while you are actually watching the trains. Starting points: `src/rail/api.ts` and `src/views/pages/rail/{client.ts,index.tsx}`. “Live” currently means recently fetched from MARTA, not recently observed by MARTA, and rail ETAs only change on poll responses. GitHub PR #96 fixed stale reopening behavior but retained this polling design.
Sign in to join this conversation.
No labels
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
clatis/pullcord#1
No description provided.