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

Commit

Permalink
feat: add configuration for refresh interval
Browse files Browse the repository at this point in the history
  • Loading branch information
KnisterPeter committed Nov 17, 2016
1 parent 12867be commit 911fbd6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
"type": "string",
"default": "master",
"description": "The branch to create pull requests against."
},
"github.refreshPullRequestStatus": {
"type": "number",
"default": 5,
"description": "Interval in seconds to refresh the current pull request status."
}
}
},
Expand Down
17 changes: 14 additions & 3 deletions src/status-bar-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,21 @@ export class StatusBarManager {
}

private async refreshPullRequestStatus(): Promise<void> {
if (this.githubManager.connected) {
await this.updatePullRequestStatus();
try {
if (this.githubManager.connected) {
await this.updatePullRequestStatus();
}
} catch (e) {
if (e instanceof GitHubError) {
console.log(e);
this.channel.appendLine('Failed to update pull request status:');
this.channel.appendLine(JSON.stringify(e.response, undefined, ' '));
} else {
throw e;
}
}
setTimeout(() => { this.refreshPullRequestStatus(); }, 5000);
setTimeout(() => { this.refreshPullRequestStatus(); },
vscode.workspace.getConfiguration('github').get<number>('refreshPullRequestStatus', 5) * 1000);
}

public async updatePullRequestStatus(): Promise<void> {
Expand Down

0 comments on commit 911fbd6

Please sign in to comment.