During an evacuation the shelter page is reloaded constantly, and every read is a call to the county’s service, which is slow, rate-limited and sometimes offline. The county updates spaces every five minutes, so the city may reuse what it fetched for up to five minutes. Responders and the public see the same shelter record.
At peak the API makes a county call for every page view, hits the county’s rate limit, and the page fails for everyone, responders included.
Reproduce
Two shelterPage(source, "public", "riverside-school") calls in the same minute should make one county call. Today they make two.
Acceptance criteria
- A shelter fetched successfully is reused for any audience allowed to see it, for up to five minutes after it was fetched (at minute 5 it is fetched again).
- Every read still passes the door first, with the confidential list as it is now: a copy fetched for a responder is never handed to the public.
- Failures are not kept: after the county comes back, or for a shelter that does not exist, the next read asks the county again.
- While the county is offline, a fresh copy still answers.
- Lists are not cached; the endpoints, the registry and openSource’s signature do not change.
Notes
- Cases print each step’s result joined by “ | ”, then county= and the number of county calls.
- The checker sets the clock to 0 at the start of each case and moves it forward during some cases. Read it through the plumbing (clock.now in TypeScript, now in Go, now() in Rust); don’t keep your own.
- Go: the API serves requests on many goroutines; anything the proxy shares between calls needs a lock.