File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
internal-packages/run-engine/src/engine/systems
references/hello-world/src/trigger Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -430,6 +430,11 @@ export class WaitpointSystem {
430430
431431 // Let the worker know immediately, so it can suspend the run
432432 await sendNotificationToWorker ( { runId, snapshot, eventBus : this . $ . eventBus } ) ;
433+
434+ if ( isRunBlocked ) {
435+ //release concurrency
436+ await this . releaseConcurrencySystem . releaseConcurrencyForSnapshot ( snapshot ) ;
437+ }
433438 }
434439
435440 if ( timeout ) {
@@ -448,10 +453,7 @@ export class WaitpointSystem {
448453
449454 //no pending waitpoint, schedule unblocking the run
450455 //debounce if we're rapidly adding waitpoints
451- if ( isRunBlocked ) {
452- //release concurrency
453- await this . releaseConcurrencySystem . releaseConcurrencyForSnapshot ( snapshot ) ;
454- } else {
456+ if ( ! isRunBlocked ) {
455457 await this . $ . worker . enqueue ( {
456458 //this will debounce the call
457459 id : `continueRunIfUnblocked:${ runId } ` ,
Original file line number Diff line number Diff line change @@ -147,3 +147,24 @@ export const waitReleaseConcurrencyTestTask = task({
147147 } ;
148148 } ,
149149} ) ;
150+
151+ export const batchTriggerAndWaitReleaseConcurrency = task ( {
152+ id : "batch-trigger-and-wait-release-concurrency" ,
153+ retry : {
154+ maxAttempts : 1 ,
155+ } ,
156+ run : async ( payload , { ctx } ) => {
157+ return await batch . triggerAndWait ( [
158+ { id : batchTriggerAndWaitChildTask . id , payload : { waitSeconds : 1 } } ,
159+ { id : batchTriggerAndWaitChildTask . id , payload : { waitSeconds : 1 } } ,
160+ { id : batchTriggerAndWaitChildTask . id , payload : { waitSeconds : 1 } } ,
161+ ] ) ;
162+ } ,
163+ } ) ;
164+
165+ const batchTriggerAndWaitChildTask = task ( {
166+ id : "batch-trigger-and-wait-child-task" ,
167+ run : async ( payload : { waitSeconds : number } , { ctx } ) => {
168+ await setTimeout ( payload . waitSeconds * 1000 ) ;
169+ } ,
170+ } ) ;
You can’t perform that action at this time.
0 commit comments