Skip to content

Commit 95d724d

Browse files
committed
fix(billing): release reserved slot if inline async job never starts
In the inline (single-process) async path, if jobQueue.startJob threw before executeWorkflowJob ran, no LoggingSession finalized and the reserved billing slot was held until TTL. Release it in the fire-and-forget catch (idempotent; a no-op when the job already finalized and released). The queued-worker path and all in-job outcomes already release via the job's LoggingSession finalize.
1 parent 8975698 commit 95d724d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • apps/sim/app/api/workflows/[id]/execute

apps/sim/app/api/workflows/[id]/execute/route.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ async function handleAsyncExecution(params: AsyncExecutionParams): Promise<NextR
304304
jobId,
305305
error: errorMessage,
306306
})
307+
// Release the reserved slot in case the job never reached
308+
// executeWorkflowJob (e.g. startJob threw) and thus never finalized a
309+
// LoggingSession to free it. Idempotent: a no-op when the job already
310+
// finalized and released.
311+
await releaseExecutionSlot(executionId)
307312
try {
308313
await jobQueue.markJobFailed(jobId, errorMessage)
309314
} catch (markFailedError) {

0 commit comments

Comments
 (0)