Skip to content

Commit 92a794c

Browse files
committed
cleanup cancellation keys after execution
1 parent 8c0ccd2 commit 92a794c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

apps/sim/lib/workflows/executor/execution-core.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import type { Edge } from 'reactflow'
77
import { z } from 'zod'
88
import { getPersonalAndWorkspaceEnv } from '@/lib/environment/utils'
9+
import { clearExecutionCancellation } from '@/lib/execution/cancellation'
910
import { createLogger } from '@/lib/logs/console/logger'
1011
import type { LoggingSession } from '@/lib/logs/execution/logging-session'
1112
import { buildTraceSpans } from '@/lib/logs/execution/trace-spans/trace-spans'
@@ -375,6 +376,8 @@ export async function executeWorkflowCore(
375376
traceSpans: traceSpans || [],
376377
})
377378

379+
await clearExecutionCancellation(executionId)
380+
378381
logger.info(`[${requestId}] Workflow execution cancelled`, {
379382
duration: result.metadata?.duration,
380383
})
@@ -383,6 +386,8 @@ export async function executeWorkflowCore(
383386
}
384387

385388
if (result.status === 'paused') {
389+
await clearExecutionCancellation(executionId)
390+
386391
logger.info(`[${requestId}] Workflow execution paused`, {
387392
duration: result.metadata?.duration,
388393
})
@@ -398,6 +403,8 @@ export async function executeWorkflowCore(
398403
workflowInput: processedInput,
399404
})
400405

406+
await clearExecutionCancellation(executionId)
407+
401408
logger.info(`[${requestId}] Workflow execution completed`, {
402409
success: result.success,
403410
duration: result.metadata?.duration,
@@ -407,7 +414,6 @@ export async function executeWorkflowCore(
407414
} catch (error: any) {
408415
logger.error(`[${requestId}] Execution failed:`, error)
409416

410-
// Extract execution result from error if available
411417
const executionResult = (error as any)?.executionResult
412418
const { traceSpans } = executionResult ? buildTraceSpans(executionResult) : { traceSpans: [] }
413419

@@ -421,6 +427,8 @@ export async function executeWorkflowCore(
421427
traceSpans,
422428
})
423429

430+
await clearExecutionCancellation(executionId)
431+
424432
throw error
425433
}
426434
}

0 commit comments

Comments
 (0)