Skip to content

Commit 7b2fba1

Browse files
committed
Apply default machine preset in config
1 parent c5377c9 commit 7b2fba1

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

.changeset/new-yaks-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Apply default machine preset in config

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,25 @@ async function bootstrap() {
9595
};
9696
}
9797

98-
const { buildManifest, importErrors } = await bootstrap();
98+
const { buildManifest, importErrors, config } = await bootstrap();
99+
100+
let tasks = taskCatalog.listTaskManifests();
101+
102+
// If the config has a machine preset, we need to apply it to all tasks that don't have a machine preset
103+
if (typeof config.machine === "string") {
104+
tasks = tasks.map((task) => {
105+
if (typeof task.machine?.preset !== "string") {
106+
return {
107+
...task,
108+
machine: {
109+
preset: config.machine,
110+
},
111+
};
112+
}
99113

100-
const tasks = taskCatalog.listTaskManifests();
114+
return task;
115+
});
116+
}
101117

102118
await sendMessageInCatalog(
103119
indexerToWorkerMessages,

references/v3-catalog/src/trigger/simple.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ let headerGenerator = new HeaderGenerator({
1111

1212
export const fetchPostTask = task({
1313
id: "fetch-post-task",
14+
machine: { preset: "small-1x" },
1415
run: async (payload: { url: string }) => {
1516
const headers = headerGenerator.getHeaders({
1617
operatingSystems: ["linux"],

references/v3-catalog/trigger.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export { handleError } from "./src/handleError.js";
1313
export default defineConfig({
1414
runtime: "node",
1515
project: "yubjwjsfkxnylobaqvqz",
16-
machine: "small-2x",
16+
machine: "medium-1x",
1717
instrumentations: [new OpenAIInstrumentation()],
1818
additionalFiles: ["wrangler/wrangler.toml"],
1919
retries: {

0 commit comments

Comments
 (0)