fix(usj): decouple wait-time and show-list fetches in live data#181
Open
cubehouse wants to merge 1 commit into
Open
fix(usj): decouple wait-time and show-list fetches in live data#181cubehouse wants to merge 1 commit into
cubehouse wants to merge 1 commit into
Conversation
buildLiveData() previously ran both CDN fetches in Promise.all, so a single endpoint failing rejected the whole live-data emission. The collector logged "Failed to fetch live data" and skipped the write — explaining multi-hour staleness gaps where one of the two endpoints had a transient issue but the other was healthy. Switch to Promise.allSettled and emit whatever succeeded. Log which side failed so future incidents are visible in prod logs. Only throw when both fail, so we still skip the write (rather than emitting empty live data that would mark every attraction CLOSED via implicit-closed semantics).
Contributor
There was a problem hiding this comment.
Pull request overview
Hardens the Universal Studios Japan destination’s buildLiveData() so transient failures of one CDN endpoint (wait times vs show list) don’t suppress all live-data emission, reducing prolonged staleness in downstream collectors.
Changes:
- Replace
Promise.allwithPromise.allSettledfor the two CDN fetches inbuildLiveData(). - Emit partial live data from whichever fetch succeeds, while logging which side failed.
- Still throw when both endpoints fail to avoid emitting an empty live-data set.
| // rather than emitting an empty live-data set (which would mark every | ||
| // attraction CLOSED via the wiki's implicit-closed semantics). | ||
| if (waitTimeResult.status === 'rejected' && showListResult.status === 'rejected') { | ||
| throw waitTimeResult.reason; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Targeted hardening of USJ's
buildLiveData()to address a multi-hour live-data staleness pattern.Previously both CDN fetches (
wait-time-attraction-list.jsonandshow-list.json) ran in a singlePromise.all. If either rejected — Akamai blip, DNS hiccup, transient 503 — the entire emission threw, the collector logged "Failed to fetch live data" and skipped the write. WithgetWaitTimeDatacached only 60s and the collector polling onupdateLoopMinutes, even a brief one-sided outage could compound into a long staleness gap if both endpoints didn't recover in the same window.Changes
Promise.all→Promise.allSettledOut of scope
The
/Venues/.../Hoursschedule endpoint is also broken (401 — auth onmobile-service.usj.co.jphas moved to a dynamic-token handshake the collector doesn't speak yet). User flagged that schedules may have moved to the website entirely (would need scraping), so deferred to a separate effort.Verified
npm run buildcleannpm test1086/1086 passnpm run dev -- universalstudiosjapan→ 104 entities, 42 live data entries — same as before this change in the happy pathTest plan