Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 911fbd6

Browse files
committed
feat: add configuration for refresh interval
1 parent 12867be commit 911fbd6

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
"type": "string",
3838
"default": "master",
3939
"description": "The branch to create pull requests against."
40+
},
41+
"github.refreshPullRequestStatus": {
42+
"type": "number",
43+
"default": 5,
44+
"description": "Interval in seconds to refresh the current pull request status."
4045
}
4146
}
4247
},

src/status-bar-manager.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,21 @@ export class StatusBarManager {
3131
}
3232

3333
private async refreshPullRequestStatus(): Promise<void> {
34-
if (this.githubManager.connected) {
35-
await this.updatePullRequestStatus();
34+
try {
35+
if (this.githubManager.connected) {
36+
await this.updatePullRequestStatus();
37+
}
38+
} catch (e) {
39+
if (e instanceof GitHubError) {
40+
console.log(e);
41+
this.channel.appendLine('Failed to update pull request status:');
42+
this.channel.appendLine(JSON.stringify(e.response, undefined, ' '));
43+
} else {
44+
throw e;
45+
}
3646
}
37-
setTimeout(() => { this.refreshPullRequestStatus(); }, 5000);
47+
setTimeout(() => { this.refreshPullRequestStatus(); },
48+
vscode.workspace.getConfiguration('github').get<number>('refreshPullRequestStatus', 5) * 1000);
3849
}
3950

4051
public async updatePullRequestStatus(): Promise<void> {

0 commit comments

Comments
 (0)