Skip to content

Preserve train departures when iRail fetching fails - #7

Merged
timvandijck merged 2 commits into
mainfrom
preserve-connections-on-fetch-failure
Oct 12, 2026
Merged

timvandijck merged 2 commits into
mainfrom
preserve-connections-on-fetch-failure

Conversation

@timvandijck

Copy link
Copy Markdown
Member

An iRail timeout or invalid response currently replaces a route’s stored departures with an empty list, making the tile go blank. Keep the last successful departures for failed routes while allowing successful routes to refresh. A successful empty response still clears the route.

Add a nullable fetch method that distinguishes failures from empty results while preserving the existing getConnections() array contract. Store departure and destination identities to match cached routes after reordering or relabeling; use an unambiguous label fallback for data saved by older versions. Failures continue to be reported. Retained departures may be stale until the next successful fetch.

Validation: 26 targeted tests passed (85 assertions), covering HTTP 429/503/504, network errors, invalid JSON and payloads, malformed departures, partial success, successful empty results, route changes, and legacy stored data. git diff --check passed.

@timvandijck
timvandijck marked this pull request as ready for review October 12, 2026 13:26
@timvandijck
timvandijck merged commit defbd71 into main Oct 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant