File tree 2 files changed +27
-4
lines changed
internal-packages/run-engine/src/engine/systems
references/hello-world/src/trigger
2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -430,6 +430,11 @@ export class WaitpointSystem {
430
430
431
431
// Let the worker know immediately, so it can suspend the run
432
432
await sendNotificationToWorker ( { runId, snapshot, eventBus : this . $ . eventBus } ) ;
433
+
434
+ if ( isRunBlocked ) {
435
+ //release concurrency
436
+ await this . releaseConcurrencySystem . releaseConcurrencyForSnapshot ( snapshot ) ;
437
+ }
433
438
}
434
439
435
440
if ( timeout ) {
@@ -448,10 +453,7 @@ export class WaitpointSystem {
448
453
449
454
//no pending waitpoint, schedule unblocking the run
450
455
//debounce if we're rapidly adding waitpoints
451
- if ( isRunBlocked ) {
452
- //release concurrency
453
- await this . releaseConcurrencySystem . releaseConcurrencyForSnapshot ( snapshot ) ;
454
- } else {
456
+ if ( ! isRunBlocked ) {
455
457
await this . $ . worker . enqueue ( {
456
458
//this will debounce the call
457
459
id : `continueRunIfUnblocked:${ runId } ` ,
Original file line number Diff line number Diff line change @@ -147,3 +147,24 @@ export const waitReleaseConcurrencyTestTask = task({
147
147
} ;
148
148
} ,
149
149
} ) ;
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