File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
apps/sim/app/api/cron/cleanup-stale-executions Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { verifyCronAuth } from '@/lib/auth/internal'
88const logger = createLogger ( 'CleanupStaleExecutions' )
99
1010const STALE_THRESHOLD_MINUTES = 30
11+ const MAX_INT32 = 2_147_483_647
1112
1213export async function GET ( request : NextRequest ) {
1314 try {
@@ -45,13 +46,14 @@ export async function GET(request: NextRequest) {
4546 try {
4647 const staleDurationMs = Date . now ( ) - new Date ( execution . startedAt ) . getTime ( )
4748 const staleDurationMinutes = Math . round ( staleDurationMs / 60000 )
49+ const totalDurationMs = Math . min ( staleDurationMs , MAX_INT32 )
4850
4951 await db
5052 . update ( workflowExecutionLogs )
5153 . set ( {
5254 status : 'failed' ,
5355 endedAt : new Date ( ) ,
54- totalDurationMs : staleDurationMs ,
56+ totalDurationMs,
5557 executionData : sql `jsonb_set(
5658 COALESCE(execution_data, '{}'::jsonb),
5759 ARRAY['error'],
You can’t perform that action at this time.
0 commit comments