Commit fef3854
fix(plopsa): trust wait-times feed over stale temporarily_closed hint
Diagnostic logs show a subset of rides (8 at a time) flapping
OPERATING ↔ CLOSED every ~3 minutes — independent of `parkOpenNow`,
which stays steady. Pattern is per-ride, lockstep across the same set
of rides each cycle.
Cause: the per-ride `closedById` map (built from POI's
`temporarily_closed` flag) is the deciding bit when it disagrees with
the live wait-times feed. POI is HTTP-cached for 12 hours, and on a
multi-instance deployment two collectors that fetched POI at slightly
different moments end up with different cached snapshots — one says
"ride X is temp-closed", the other says "open" — and they alternate
writes on every poll cycle.
The wait-times feed is the ground truth for "is this ride currently
taking guests": if it gives us a numeric value, the ride is operating
regardless of what POI's cached `temporarily_closed` hint says. The
hint is only authoritative when the wait-times feed has no number for
the ride.
Decision logic extracted into a pure `plopsaDecideOperating(parkOpenNow,
tempClosed, hasWait)` helper. Unit-tested matrix in
`__tests__/plopsa.test.ts` covers all 8 input combinations and pins the
specific pre-fix bug case (open + temp-closed + has-wait → was CLOSED,
now OPERATING).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 29ef35a commit fef3854
2 files changed
Lines changed: 63 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
100 | 121 | | |
101 | 122 | | |
102 | 123 | | |
| |||
432 | 453 | | |
433 | 454 | | |
434 | 455 | | |
435 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
436 | 459 | | |
437 | 460 | | |
438 | 461 | | |
| |||
441 | 464 | | |
442 | 465 | | |
443 | 466 | | |
444 | | - | |
| 467 | + | |
445 | 468 | | |
446 | 469 | | |
447 | 470 | | |
| |||
0 commit comments