Skip to content

Commit 30f9352

Browse files
authored
fix: default machine config indexing now works (#1979)
1 parent 18f7766 commit 30f9352

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

.changeset/spotty-ducks-punch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
fix: default machine config indexing now works

packages/cli-v3/src/entryPoints/dev-index-worker.ts

+16
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ if (typeof config.maxDuration === "number") {
128128
});
129129
}
130130

131+
// If the config has a machine preset, we need to apply it to all tasks that don't have a machine preset
132+
if (typeof config.machine === "string") {
133+
tasks = tasks.map((task) => {
134+
if (typeof task.machine?.preset !== "string") {
135+
return {
136+
...task,
137+
machine: {
138+
preset: config.machine,
139+
},
140+
} satisfies TaskManifest;
141+
}
142+
143+
return task;
144+
});
145+
}
146+
131147
await sendMessageInCatalog(
132148
indexerToWorkerMessages,
133149
"INDEX_COMPLETE",

packages/cli-v3/src/entryPoints/managed-index-worker.ts

+16
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ if (typeof config.maxDuration === "number") {
128128
});
129129
}
130130

131+
// If the config has a machine preset, we need to apply it to all tasks that don't have a machine preset
132+
if (typeof config.machine === "string") {
133+
tasks = tasks.map((task) => {
134+
if (typeof task.machine?.preset !== "string") {
135+
return {
136+
...task,
137+
machine: {
138+
preset: config.machine,
139+
},
140+
} satisfies TaskManifest;
141+
}
142+
143+
return task;
144+
});
145+
}
146+
131147
await sendMessageInCatalog(
132148
indexerToWorkerMessages,
133149
"INDEX_COMPLETE",

references/hello-world/src/trigger/example.ts

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const helloWorldTask = task({
3737

3838
export const parentTask = task({
3939
id: "parent",
40+
machine: "medium-1x",
4041
run: async (payload: any, { ctx }) => {
4142
logger.log("Hello, world from the parent", { payload });
4243
await childTask.triggerAndWait(

references/hello-world/trigger.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default defineConfig({
1515
randomize: true,
1616
},
1717
},
18+
machine: "large-1x",
1819
build: {
1920
extensions: [
2021
{

0 commit comments

Comments
 (0)