Skip to content

Commit b53ed5d

Browse files
committed
update stale exec cleanup route
1 parent d7259e3 commit b53ed5d

File tree

1 file changed

+3
-1
lines changed
  • apps/sim/app/api/cron/cleanup-stale-executions

1 file changed

+3
-1
lines changed

apps/sim/app/api/cron/cleanup-stale-executions/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import { createLogger } from '@sim/logger'
44
import { and, eq, lt, sql } from 'drizzle-orm'
55
import { type NextRequest, NextResponse } from 'next/server'
66
import { verifyCronAuth } from '@/lib/auth/internal'
7+
import { getMaxExecutionTimeout } from '@/lib/core/execution-limits'
78

89
const logger = createLogger('CleanupStaleExecutions')
910

10-
const STALE_THRESHOLD_MINUTES = 30
11+
const STALE_THRESHOLD_MS = getMaxExecutionTimeout() + 5 * 60 * 1000
12+
const STALE_THRESHOLD_MINUTES = Math.ceil(STALE_THRESHOLD_MS / 60000)
1113
const MAX_INT32 = 2_147_483_647
1214

1315
export async function GET(request: NextRequest) {

0 commit comments

Comments
 (0)