@@ -486,56 +486,52 @@ export class RunEngine {
486486
487487 span . setAttribute ( "runId" , taskRun . id ) ;
488488
489- await this . runLock . lock ( "trigger" , [ taskRun . id ] , 5000 , async ( signal ) => {
490- //create associated waitpoint (this completes when the run completes)
491- const associatedWaitpoint = await this . waitpointSystem . createRunAssociatedWaitpoint (
492- prisma ,
493- {
494- projectId : environment . project . id ,
495- environmentId : environment . id ,
496- completedByTaskRunId : taskRun . id ,
497- }
498- ) ;
499-
500- //triggerAndWait or batchTriggerAndWait
501- if ( resumeParentOnCompletion && parentTaskRunId ) {
502- //this will block the parent run from continuing until this waitpoint is completed (and removed)
503- await this . waitpointSystem . blockRunWithWaitpoint ( {
504- runId : parentTaskRunId ,
505- waitpoints : associatedWaitpoint . id ,
506- projectId : associatedWaitpoint . projectId ,
507- organizationId : environment . organization . id ,
508- batch,
509- workerId,
510- runnerId,
511- tx : prisma ,
512- releaseConcurrency,
513- } ) ;
489+ //create associated waitpoint (this completes when the run completes)
490+ const associatedWaitpoint = await this . waitpointSystem . createRunAssociatedWaitpoint (
491+ prisma ,
492+ {
493+ projectId : environment . project . id ,
494+ environmentId : environment . id ,
495+ completedByTaskRunId : taskRun . id ,
514496 }
497+ ) ;
515498
516- //Make sure lock extension succeeded
517- signal . throwIfAborted ( ) ;
518-
519- if ( taskRun . delayUntil ) {
520- // Schedule the run to be enqueued at the delayUntil time
521- await this . delayedRunSystem . scheduleDelayedRunEnqueuing ( {
522- runId : taskRun . id ,
523- delayUntil : taskRun . delayUntil ,
524- } ) ;
525- } else {
526- await this . enqueueSystem . enqueueRun ( {
527- run : taskRun ,
528- env : environment ,
529- workerId,
530- runnerId,
531- tx : prisma ,
532- } ) ;
499+ //triggerAndWait or batchTriggerAndWait
500+ if ( resumeParentOnCompletion && parentTaskRunId ) {
501+ //this will block the parent run from continuing until this waitpoint is completed (and removed)
502+ await this . waitpointSystem . blockRunWithWaitpoint ( {
503+ runId : parentTaskRunId ,
504+ waitpoints : associatedWaitpoint . id ,
505+ projectId : associatedWaitpoint . projectId ,
506+ organizationId : environment . organization . id ,
507+ batch,
508+ workerId,
509+ runnerId,
510+ tx : prisma ,
511+ releaseConcurrency,
512+ } ) ;
513+ }
533514
534- if ( taskRun . ttl ) {
535- await this . ttlSystem . scheduleExpireRun ( { runId : taskRun . id , ttl : taskRun . ttl } ) ;
536- }
515+ if ( taskRun . delayUntil ) {
516+ // Schedule the run to be enqueued at the delayUntil time
517+ await this . delayedRunSystem . scheduleDelayedRunEnqueuing ( {
518+ runId : taskRun . id ,
519+ delayUntil : taskRun . delayUntil ,
520+ } ) ;
521+ } else {
522+ if ( taskRun . ttl ) {
523+ await this . ttlSystem . scheduleExpireRun ( { runId : taskRun . id , ttl : taskRun . ttl } ) ;
537524 }
538- } ) ;
525+
526+ await this . enqueueSystem . enqueueRun ( {
527+ run : taskRun ,
528+ env : environment ,
529+ workerId,
530+ runnerId,
531+ tx : prisma ,
532+ skipRunLock : true ,
533+ } ) ;
534+ }
539535
540536 this . eventBus . emit ( "runCreated" , {
541537 time : new Date ( ) ,
0 commit comments