From b53ed5dae045681d96784c8451658a96bc056fa4 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Tue, 3 Feb 2026 16:23:22 -0800 Subject: [PATCH] update stale exec cleanup route --- apps/sim/app/api/cron/cleanup-stale-executions/route.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/sim/app/api/cron/cleanup-stale-executions/route.ts b/apps/sim/app/api/cron/cleanup-stale-executions/route.ts index 2b0859143..a7bb1aa35 100644 --- a/apps/sim/app/api/cron/cleanup-stale-executions/route.ts +++ b/apps/sim/app/api/cron/cleanup-stale-executions/route.ts @@ -4,10 +4,12 @@ import { createLogger } from '@sim/logger' import { and, eq, lt, sql } from 'drizzle-orm' import { type NextRequest, NextResponse } from 'next/server' import { verifyCronAuth } from '@/lib/auth/internal' +import { getMaxExecutionTimeout } from '@/lib/core/execution-limits' const logger = createLogger('CleanupStaleExecutions') -const STALE_THRESHOLD_MINUTES = 30 +const STALE_THRESHOLD_MS = getMaxExecutionTimeout() + 5 * 60 * 1000 +const STALE_THRESHOLD_MINUTES = Math.ceil(STALE_THRESHOLD_MS / 60000) const MAX_INT32 = 2_147_483_647 export async function GET(request: NextRequest) {