|
3 | 3 | "@trigger.dev/core": patch
|
4 | 4 | ---
|
5 | 5 |
|
6 |
| -Add support for specifying machine preset at trigger time |
| 6 | +Add support for specifying machine preset at trigger time. Works with any trigger function: |
| 7 | + |
| 8 | +```ts |
| 9 | +// Same as usual, will use the machine preset on childTask, defaults to "small-1x" |
| 10 | +await childTask.trigger({ message: "Hello, world!" }); |
| 11 | + |
| 12 | +// This will override the task's machine preset and any defaults. Works with all trigger functions. |
| 13 | +await childTask.trigger({ message: "Hello, world!" }, { machinePreset: "small-2x" }); |
| 14 | +await childTask.triggerAndWait({ message: "Hello, world!" }, { machinePreset: "small-2x" }); |
| 15 | + |
| 16 | +await childTask.batchTrigger([ |
| 17 | + { payload: { message: "Hello, world!" }, options: { machinePreset: "micro" } }, |
| 18 | + { payload: { message: "Hello, world!" }, options: { machinePreset: "large-1x" } }, |
| 19 | +]); |
| 20 | +await childTask.batchTriggerAndWait([ |
| 21 | + { payload: { message: "Hello, world!" }, options: { machinePreset: "micro" } }, |
| 22 | + { payload: { message: "Hello, world!" }, options: { machinePreset: "large-1x" } }, |
| 23 | +]); |
| 24 | + |
| 25 | +await tasks.trigger<typeof childTask>( |
| 26 | + "child", |
| 27 | + { message: "Hello, world!" }, |
| 28 | + { machinePreset: "small-2x" } |
| 29 | +); |
| 30 | +await tasks.batchTrigger<typeof childTask>("child", [ |
| 31 | + { payload: { message: "Hello, world!" }, options: { machinePreset: "micro" } }, |
| 32 | + { payload: { message: "Hello, world!" }, options: { machinePreset: "large-1x" } }, |
| 33 | +]); |
| 34 | +``` |
0 commit comments