Should the events page serve old data when Postgres is down?
After this you can answer: Should the events page serve old data when Postgres is down?
Say it in 30 seconds
Section titled “Say it in 30 seconds”The deeper answer
Section titled “The deeper answer”Freshness has two thresholds. The default soft TTL is thirty seconds with up to ten percent jitter. After that, readers receive the stale list while refresh work runs. The hard TTL is five minutes, and the code checks age as well as relying on Redis expiry. After that boundary, the old copy must not be served.
The stale-if-error label reflects a failed background refresh in that API process. It is diagnostic state, not a guarantee that every task has observed the same failure. A newly invalidated generation is empty, so the service must not resurrect a previous generation merely because Postgres is unavailable.
This is appropriate for approximate browsing information. It would be unsafe as the authority for selling a seat. Also, Redis lookup for a supplied session cookie happens before the events service: an outage there can fail the request before any cache fallback. Production error budgets should separate anonymous browsing, authenticated browsing and booking.
Counter-questions
Section titled “Counter-questions”What happens on the first request after hard expiry?
Can a lost background refresh lose a confirmation?
Why not serve stale data indefinitely?
Where in MiniTickets
Section titled “Where in MiniTickets”Read Caching, then inspect the events-cache piece →.
apps/api/src/services/events.ts → listUpcomingEventsRead this book online: https://book.theversehub.in/