Skip to content

Commit 030d4f8

Browse files
committed
fix poller
1 parent 990ac46 commit 030d4f8

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class ManagedRunController {
108108
httpClient: this.httpClient,
109109
logger: this.logger,
110110
snapshotPollIntervalSeconds: this.snapshotPollIntervalSeconds,
111-
handleSnapshotChange: this.handleSnapshotChange,
111+
handleSnapshotChange: this.handleSnapshotChange.bind(this),
112112
});
113113

114114
this.runHeartbeat = new RunExecutionHeartbeat({

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ export class RunExecutionHeartbeat {
2525
this.runFriendlyId = opts.runFriendlyId;
2626
this.snapshotFriendlyId = opts.snapshotFriendlyId;
2727

28+
this.logger.sendDebugLog({
29+
runId: this.runFriendlyId,
30+
message: "RunExecutionHeartbeat",
31+
properties: {
32+
runFriendlyId: this.runFriendlyId,
33+
snapshotFriendlyId: this.snapshotFriendlyId,
34+
heartbeatIntervalSeconds: opts.heartbeatIntervalSeconds,
35+
},
36+
});
37+
2838
this.heartbeat = new HeartbeatService({
2939
heartbeat: async () => {
3040
this.logger.sendDebugLog({

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ export class RunExecutionSnapshotPoller {
1919
private readonly runFriendlyId: string;
2020
private snapshotFriendlyId: string;
2121

22-
private readonly snapshotPollIntervalSeconds: number;
23-
24-
private readonly handleSnapshotChange: (execution: RunExecutionData) => Promise<void>;
25-
2622
constructor(opts: RunExecutionSnapshotPollerOptions) {
2723
this.logger = opts.logger;
2824
this.httpClient = opts.httpClient;
2925

3026
this.runFriendlyId = opts.runFriendlyId;
3127
this.snapshotFriendlyId = opts.snapshotFriendlyId;
3228

33-
this.handleSnapshotChange = opts.handleSnapshotChange;
29+
this.logger.sendDebugLog({
30+
runId: this.runFriendlyId,
31+
message: "RunExecutionSnapshotPoller",
32+
properties: {
33+
runFriendlyId: this.runFriendlyId,
34+
snapshotFriendlyId: this.snapshotFriendlyId,
35+
snapshotPollIntervalSeconds: opts.snapshotPollIntervalSeconds,
36+
},
37+
});
3438

3539
this.poller = new HeartbeatService({
3640
heartbeat: async () => {
@@ -78,9 +82,9 @@ export class RunExecutionSnapshotPoller {
7882
return;
7983
}
8084

81-
await this.handleSnapshotChange(response.data.execution);
85+
await opts.handleSnapshotChange(response.data.execution);
8286
},
83-
intervalMs: this.snapshotPollIntervalSeconds * 1000,
87+
intervalMs: opts.snapshotPollIntervalSeconds * 1000,
8488
leadingEdge: false,
8589
onError: async (error) => {
8690
this.logger.sendDebugLog({

0 commit comments

Comments
 (0)