Mitigating 504 Gateway Timeouts

ewan June 6, 2026
Source
fixing the 504s Been 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. the approach Had to break the dependency on slow server-side fetches: - Concurrency Limiter: Wrote mapWithConcurrency. Now fetchSubscriptions, fetchRecommendations, and fetchComments actually respect limits instead of just firing off everything at once and praying. - 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. Pages are way faster, and the errors have stopped. Good trade.

Discussion in the ATmosphere

Loading comments...