Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/sharp-cheetahs-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"trigger.dev": patch
---

- Reduce restore times by 5s due to immediate polling
- Fix `s is not a function` and surface underlying error messages
2 changes: 1 addition & 1 deletion packages/cli-v3/src/entryPoints/managed/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ export class ManagedRunController {
supervisorApiUrl: this.env.TRIGGER_SUPERVISOR_API_URL,
};

await this.currentExecution.processEnvOverrides("socket disconnected");
await this.currentExecution.processEnvOverrides("socket disconnected", true);

const newEnv = {
workerInstanceName: this.env.TRIGGER_WORKER_INSTANCE_NAME,
Expand Down
11 changes: 10 additions & 1 deletion packages/cli-v3/src/entryPoints/managed/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,10 @@ export class RunExecution {
/**
* Processes env overrides from the metadata service. Generally called when we're resuming from a suspended state.
*/
public async processEnvOverrides(reason?: string): Promise<{ overrides: Metadata } | null> {
public async processEnvOverrides(
reason?: string,
shouldPollForSnapshotChanges?: boolean
): Promise<{ overrides: Metadata } | null> {
if (!this.metadataClient) {
return null;
}
Expand Down Expand Up @@ -943,6 +946,12 @@ export class RunExecution {
this.httpClient.updateRunnerId(this.env.TRIGGER_RUNNER_ID);
}

// Poll for snapshot changes immediately
if (shouldPollForSnapshotChanges) {
this.sendDebugLog("[override] polling for snapshot changes", { reason });
this.fetchAndProcessSnapshotChanges("restore").catch(() => {});
}

return {
overrides,
};
Expand Down
20 changes: 19 additions & 1 deletion packages/cli-v3/src/utilities/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,30 @@ const wrappedClackSpinner = () => {
spinner.start(truncateMessage(currentMessage));
},
stop: (msg?: string, code?: number): void => {
isActive = false;
process.stdout.off("resize", handleResize);

if (!isActive) {
// Spinner was never started, just display the message
if (msg) {
log.message(msg);
}
return;
}

isActive = false;
spinner.stop(truncateMessage(msg ?? ""), code);
},
message: (msg?: string): void => {
currentMessage = msg ?? "";

if (!isActive) {
// Spinner was never started, just display the message
if (msg) {
log.message(msg);
}
return;
}

spinner.message(truncateMessage(currentMessage));
},
};
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish-prerelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [[ -z "${GITHUB_TOKEN}" ]]; then
fi

# Use the first argument as version or 'v3-prerelease' if not available
version=${1:-'v3-prerelease'}
version=${1:-'v4-prerelease'}

# Ensure git stage is clear
if [[ $(git status --porcelain) ]]; then
Expand Down
Loading