Skip to content

Commit a00adb1

Browse files
Copilotalexr00
andcommitted
Improve code safety and comments based on code review
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 3a2c363 commit a00adb1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/notifications/notificationsManager.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,8 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
433433
return;
434434
}
435435

436-
// Note: We ignore the pollInterval from GitHub's response and use the user-configured interval instead
436+
// Use the user-configured interval instead of GitHub's poll interval to respect user preferences.
437+
// This allows users to control notification refresh frequency for managing notification volume and API rate limits.
437438
if (response.lastModified !== this._pollingLastModified) {
438439
this._pollingLastModified = response.lastModified;
439440
this._onDidChangeTreeData.fire();
@@ -470,7 +471,13 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
470471
refreshInterval * 1000,
471472
this
472473
);
473-
this._pollingDisposable = this._register({ dispose: () => clearInterval(this._pollingHandler!) });
474+
this._pollingDisposable = this._register({
475+
dispose: () => {
476+
if (this._pollingHandler) {
477+
clearInterval(this._pollingHandler);
478+
}
479+
}
480+
});
474481
}
475482

476483
private _findNotificationKeyForIssueModel(issueModel: IssueModel | PullRequestModel | { owner: string; repo: string; number: number }): string | undefined {

0 commit comments

Comments
 (0)