From 7bda141ca5265963a4b120bed8d748442b2dbc21 Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Tue, 10 Feb 2026 18:31:56 -0800 Subject: [PATCH] Show request duration warning after 240s for long requests --- .../src/route-handlers/smart-route-handler.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/backend/src/route-handlers/smart-route-handler.tsx b/apps/backend/src/route-handlers/smart-route-handler.tsx index 7de3a36b1..19bcb370a 100644 --- a/apps/backend/src/route-handlers/smart-route-handler.tsx +++ b/apps/backend/src/route-handlers/smart-route-handler.tsx @@ -114,15 +114,13 @@ export function handleApiRequest(handler: (req: NextRequest, options: any, reque "/api/latest/internal/external-db-sync/sequencer", "/api/latest/internal/external-db-sync/sync-engine", ]; - if (!allowedLongRequestPaths.includes(req.nextUrl.pathname)) { - const warnAfterSeconds = 12; - runAsynchronously(async () => { - await wait(warnAfterSeconds * 1000); - if (!hasRequestFinished) { - captureError("request-timeout-watcher", new Error(`Request with ID ${requestId} to ${req.method} ${req.nextUrl.pathname} has been running for ${warnAfterSeconds} seconds. Try to keep requests short. The request may be cancelled by the serverless provider if it takes too long.`)); - } - }); - } + const warnAfterSeconds = allowedLongRequestPaths.includes(req.nextUrl.pathname) ? 180 : 12; + runAsynchronously(async () => { + await wait(warnAfterSeconds * 1000); + if (!hasRequestFinished) { + captureError("request-timeout-watcher", new Error(`Request with ID ${requestId} to ${req.method} ${req.nextUrl.pathname} has been running for ${warnAfterSeconds} seconds. Try to keep requests short. The request may be cancelled by the serverless provider if it takes too long.`)); + } + }); if (!disableExtendedLogging) console.log(`[API REQ] [${requestId}] ${req.method} ${censoredUrl}`); const timeStart = performance.now();