File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
references/hello-world/src/trigger Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { logger , task , wait } from "@trigger.dev/sdk/v3" ;
2
+
3
+ export const prioritizeContinuing = task ( {
4
+ id : "prioritize-continuing" ,
5
+ run : async ( { count } : { count : number } ) => {
6
+ await prioritizeContinuingChild . batchTrigger (
7
+ Array . from ( { length : count } , ( _ , i ) => ( { payload : { } as any } ) )
8
+ ) ;
9
+ } ,
10
+ } ) ;
11
+
12
+ export const prioritizeContinuingChild = task ( {
13
+ id : "prioritize-continuing-child" ,
14
+ queue : {
15
+ concurrencyLimit : 1 ,
16
+ } ,
17
+ run : async ( ) => {
18
+ await fixedLengthTask . triggerAndWait ( { waitSeconds : 1 } ) ;
19
+ } ,
20
+ } ) ;
21
+
22
+ export const fixedLengthTask = task ( {
23
+ id : "fixedLengthTask" ,
24
+ run : async ( { waitSeconds } : { waitSeconds : number } ) => {
25
+ await new Promise ( ( resolve ) => setTimeout ( resolve , waitSeconds * 1000 ) ) ;
26
+ } ,
27
+ } ) ;
You can’t perform that action at this time.
0 commit comments