Skip to content

Commit 4aeaef8

Browse files
committed
fix(runner): immediate poll to decrease restore time
1 parent 3c199e6 commit 4aeaef8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/cli-v3/src/entryPoints/managed/controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ export class ManagedRunController {
514514
supervisorApiUrl: this.env.TRIGGER_SUPERVISOR_API_URL,
515515
};
516516

517-
await this.currentExecution.processEnvOverrides("socket disconnected");
517+
await this.currentExecution.processEnvOverrides("socket disconnected", true);
518518

519519
const newEnv = {
520520
workerInstanceName: this.env.TRIGGER_WORKER_INSTANCE_NAME,

packages/cli-v3/src/entryPoints/managed/execution.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,10 @@ export class RunExecution {
896896
/**
897897
* Processes env overrides from the metadata service. Generally called when we're resuming from a suspended state.
898898
*/
899-
public async processEnvOverrides(reason?: string): Promise<{ overrides: Metadata } | null> {
899+
public async processEnvOverrides(
900+
reason?: string,
901+
shouldPollForSnapshotChanges?: boolean
902+
): Promise<{ overrides: Metadata } | null> {
900903
if (!this.metadataClient) {
901904
return null;
902905
}
@@ -943,6 +946,12 @@ export class RunExecution {
943946
this.httpClient.updateRunnerId(this.env.TRIGGER_RUNNER_ID);
944947
}
945948

949+
// Poll for snapshot changes immediately
950+
if (shouldPollForSnapshotChanges) {
951+
this.sendDebugLog("[override] polling for snapshot changes", { reason });
952+
this.fetchAndProcessSnapshotChanges("restore").catch(() => {});
953+
}
954+
946955
return {
947956
overrides,
948957
};

0 commit comments

Comments
 (0)