File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -72,8 +72,7 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
7272 }
7373 if ( e . affectsConfiguration ( `${ PR_SETTINGS_NAMESPACE } .${ NOTIFICATIONS_REFRESH_INTERVAL } ` ) ) {
7474 if ( this . isPRNotificationsOn ( ) ) {
75- // Restart polling with new interval
76- this . _stopPolling ( ) ;
75+ // Restart polling with new interval (stopPolling is called inside startPolling)
7776 this . _startPolling ( ) ;
7877 }
7978 }
@@ -443,21 +442,24 @@ export class NotificationsManager extends Disposable implements vscode.TreeDataP
443442 }
444443
445444 private _stopPolling ( ) {
445+ if ( this . _pollingDisposable ) {
446+ this . _pollingDisposable . dispose ( ) ;
447+ this . _pollingDisposable = null ;
448+ }
446449 if ( this . _pollingHandler ) {
447450 Logger . appendLine ( 'Notifications: Clearing interval' , NotificationsManager . ID ) ;
448451 clearInterval ( this . _pollingHandler ) ;
449452 this . _pollingHandler = null ;
450453 }
451- if ( this . _pollingDisposable ) {
452- this . _pollingDisposable . dispose ( ) ;
453- this . _pollingDisposable = null ;
454- }
455454 }
456455
457456 private _startPolling ( ) {
458457 if ( ! this . isPRNotificationsOn ( ) ) {
459458 return ;
460459 }
460+ // Stop any existing polling to prevent resource leaks
461+ this . _stopPolling ( ) ;
462+
461463 const refreshInterval = this . _getRefreshInterval ( ) ;
462464 Logger . appendLine ( `Notifications: Starting polling with interval ${ refreshInterval } seconds` , NotificationsManager . ID ) ;
463465 this . _pollForNewNotifications ( ) ;
You can’t perform that action at this time.
0 commit comments