{
  "$type": "site.standard.document",
  "canonicalUrl": "https://devlog.croft.click/2026/06/06/mitigating-504-timeouts",
  "description": "Addressing persistent 504 Gateway Timeout errors on Vercel by optimising AT Protocol data fetching.",
  "path": "/2026/06/06/mitigating-504-timeouts",
  "publishedAt": "2026-06-06T00:00:00.000Z",
  "site": "at://did:plc:ofrbh253gwicbkc5nktqepol/site.standard.publication/3mlen2qhzrt2s",
  "tags": [
    "website",
    "infra",
    "performance"
  ],
  "textContent": "fixing the 504s\n\nBeen getting crushed by 504 Gateway Timeouts on Vercel. Turns out, the home page was doing way too much synchronous, concurrent fetching against the AT Protocol network during SSR. Vercel’s serverless timeouts are brutal, and I was blowing past them.\n\nthe approach\n\nHad to break the dependency on slow server-side fetches:\n\n- Concurrency Limiter: Wrote mapWithConcurrency. Now fetchSubscriptions, fetchRecommendations, and fetchComments actually respect limits instead of just firing off everything at once and praying.\n- Client-Side Offloading: Kept profile data in the SSR load (SEO needs it), but everything else? Moved that to the client. Created an /api/home endpoint, and now the heavy lifting happens asynchronously after the page loads.\n\nPages are way faster, and the errors have stopped. Good trade.",
  "title": "Mitigating 504 Gateway Timeouts"
}