File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
references/v3-catalog/src/trigger Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -139,3 +139,29 @@ export const multipleTriggerWaits = task({
139
139
} ;
140
140
} ,
141
141
} ) ;
142
+
143
+ export const triggerAndWaitLoops = task ( {
144
+ id : "trigger-wait-loops" ,
145
+ run : async ( { message = "test" } : { message ?: string } ) => {
146
+ for ( let i = 0 ; i < 2 ; i ++ ) {
147
+ await simpleChildTask . triggerAndWait ( { payload : { message : `${ message } - ${ i } ` } } ) ;
148
+ }
149
+
150
+ for ( let i = 0 ; i < 2 ; i ++ ) {
151
+ await simpleChildTask . batchTriggerAndWait ( {
152
+ items : [
153
+ { payload : { message : `${ message } - ${ i } .a` } } ,
154
+ { payload : { message : `${ message } - ${ i } .b` } } ,
155
+ ] ,
156
+ // batchOptions: { maxConcurrency: 1 },
157
+ } ) ;
158
+ }
159
+
160
+ // Don't do this!
161
+ // await Promise.all(
162
+ // [{ message: `${message} - 1` }, { message: `${message} - 2` }].map((payload) =>
163
+ // simpleChildTask.triggerAndWait({ payload })
164
+ // )
165
+ // );
166
+ } ,
167
+ } ) ;
You can’t perform that action at this time.
0 commit comments