File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
internal-packages/run-engine/src/engine Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ export function isCheckpointable(status: TaskRunExecutionStatus): boolean {
31
31
return checkpointableStatuses . includes ( status ) ;
32
32
}
33
33
34
+ export function isFinishedOrPendingFinished ( status : TaskRunExecutionStatus ) : boolean {
35
+ const finishedStatuses : TaskRunExecutionStatus [ ] = [ "FINISHED" , "PENDING_CANCEL" ] ;
36
+ return finishedStatuses . includes ( status ) ;
37
+ }
38
+
34
39
export function isFinalRunStatus ( status : TaskRunStatus ) : boolean {
35
40
const finalStatuses : TaskRunStatus [ ] = [
36
41
"CANCELED" ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
10
10
} from "@trigger.dev/database" ;
11
11
import { nanoid } from "nanoid" ;
12
12
import { sendNotificationToWorker } from "../eventBus.js" ;
13
- import { isExecuting } from "../statuses.js" ;
13
+ import { isExecuting , isFinishedOrPendingFinished } from "../statuses.js" ;
14
14
import { EnqueueSystem } from "./enqueueSystem.js" ;
15
15
import { ExecutionSnapshotSystem , getLatestExecutionSnapshot } from "./executionSnapshotSystem.js" ;
16
16
import { SystemResources } from "./systems.js" ;
@@ -512,6 +512,14 @@ export class WaitpointSystem {
512
512
await this . $ . runLock . lock ( [ runId ] , 5000 , async ( ) => {
513
513
const snapshot = await getLatestExecutionSnapshot ( this . $ . prisma , runId ) ;
514
514
515
+ if ( isFinishedOrPendingFinished ( snapshot . executionStatus ) ) {
516
+ this . $ . logger . debug ( `#continueRunIfUnblocked: run is finished, skipping` , {
517
+ runId,
518
+ snapshot,
519
+ } ) ;
520
+ return ;
521
+ }
522
+
515
523
//run is still executing, send a message to the worker
516
524
if ( isExecuting ( snapshot . executionStatus ) ) {
517
525
const result = await this . $ . runQueue . reacquireConcurrency (
You can’t perform that action at this time.
0 commit comments