feat(tripwire): in-memory SWR on the page, per-call timeouts on the crons#30
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
src/lib/tripwire/aggregates.ts: module-level singleton with a 2-minute TTL. The build-stats cron republishes stats/tripwire-aggregates.json every ~15 minutes, so a warm Fluid Compute instance only pays for the blob fetch once per 2-minute window. On TTL expiry the next request triggers a fresh fetch. On any fetch error we throw and let the error boundary surface it — no stale fallback, since silently lying about freshness is worse than a visible failure. src/app/x/tripwire/error.tsx: client error boundary for the route. Surfaces the error message and a retry button instead of leaving the page stuck on a Suspense skeleton when getAggregates() throws. src/lib/tripwire/aggregates.test.ts: four cases — cache miss fetches, cache hit within TTL skips the fetch, expired TTL re-fetches, and non-200 status throws. src/proxy.test.ts: spread real @vercel/blob exports into each mock.module() call so the module shape stays stable for tests in other files that import list/get/etc.
cbb9fdc to
750ff2c
Compare
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
Three targeted changes against the persistent "first outbound call hangs" pattern we see in production logs:
`src/lib/tripwire/aggregates.ts` — page-side SWR
`src/lib/tripwire/ingest.ts` — per-call timeouts
`src/lib/tripwire/stats.ts` — parallelize, don't retry
Verified through `next dev`
171 unit tests pass · build clean · lint clean.