feat(ScheduleController): smaller schedules_for_stop response + logging #1790
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
Asana Ticket: Stop pages intermittently missing Commuter Rail schedules
I happened to be able to consistently reproduce the problem for a particular bus route on a particular stop on prod... but ultimately I never figured out a definitive cause for this. Splunk didn't reveal any errors. No network problems or console errors. I suspect that caching might exacerbate the problem and cause the backend to return
[]
instead of re-trying within the cachemax_age
window. But still, ideally it wouldn't erroneously return[]
in the first place.This PR does 3 things:
Schedules.Repo.schedules_for_stop/2
call returns{:error, error}
value. An error will be logged in Splunk and the frontend would handle it by showing the error view with the bus gif.Schedules.Repo
error.SiteWeb.ScheduleController.schedules_for_stop/2
in hopes of improving performance. It removes data that's not used on the frontend.Comparison for Alewife Station (
/api/stops/place-alfcl/schedules?last_stop_departures=false&future_departures=true
), using Chrome DevTools with no caching and "Fast 3G" network throttling setting:General checks