Skip to content

Commit 89fbe5a

Browse files
committed
Fix #229: Add verbose logging for debugging polling issues
1 parent ba66672 commit 89fbe5a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/commands/triggerWorkflowRun.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {getWorkflowUri, parseWorkflowFile} from "../workflow/workflow";
66
import {Workflow} from "../model";
77
import {RunStore} from "../store/store";
88

9+
import {log} from "../log";
10+
911
interface TriggerRunCommandOptions {
1012
wf?: Workflow;
1113
gitHubRepoContext: GitHubRepoContext;
@@ -171,13 +173,14 @@ export function registerTriggerWorkflowRun(context: vscode.ExtensionContext, sto
171173
});
172174
const newLatestRunId = result.data.workflow_runs[0]?.id;
173175
if (newLatestRunId && newLatestRunId !== latestRunId) {
176+
log(`Found new workflow run: ${newLatestRunId}. Triggering refresh and polling.`);
174177
await vscode.commands.executeCommand("github-actions.explorer.refresh");
175178
// Poll for 15 minutes (225 * 4s)
176179
store.pollRun(newLatestRunId, gitHubRepoContext, 4000, 225);
177180
break;
178181
}
179182
} catch (e) {
180-
// Ignore
183+
log(`Error checking for new run: ${(e as Error).message}`);
181184
}
182185
}
183186
});

src/store/store.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {setInterval} from "timers";
22
import {EventEmitter} from "vscode";
33
import {GitHubRepoContext} from "../git/repository";
4-
import {logDebug} from "../log";
4+
import {log, logDebug} from "../log";
55
import * as model from "../model";
66
import {WorkflowRun} from "./workflowRun";
77

@@ -46,6 +46,7 @@ export class RunStore extends EventEmitter<RunStoreEvent> {
4646
* Start polling for updates for the given run
4747
*/
4848
pollRun(runId: number, repoContext: GitHubRepoContext, intervalMs: number, attempts = 10) {
49+
log(`Starting polling for run ${runId} every ${intervalMs}ms for ${attempts} attempts`);
4950
const existingUpdater: Updater | undefined = this.updaters.get(runId);
5051
if (existingUpdater && existingUpdater.handle) {
5152
clearInterval(existingUpdater.handle);
@@ -65,7 +66,7 @@ export class RunStore extends EventEmitter<RunStoreEvent> {
6566
}
6667

6768
private async fetchRun(updater: Updater) {
68-
logDebug("Updating run: ", updater.runId);
69+
log(`Fetching run update: ${updater.runId}. Remaining attempts: ${updater.remainingAttempts}`);
6970

7071
updater.remainingAttempts--;
7172
if (updater.remainingAttempts === 0) {
@@ -83,7 +84,7 @@ export class RunStore extends EventEmitter<RunStoreEvent> {
8384
});
8485

8586
const run = result.data;
86-
logDebug("Polled run:", run.id, "Status:", run.status, "Conclusion:", run.conclusion);
87+
log(`Polled run: ${run.id} Status: ${run.status} Conclusion: ${run.conclusion}`);
8788
this.addRun(updater.repoContext, run);
8889

8990
if (run.status === "completed" || run.status === "cancelled" || run.status === "failure" || run.status === "success" || run.status === "skipped" || run.status === "timed_out") {

0 commit comments

Comments
 (0)