Skip to content

Commit 86de75d

Browse files
committed
fix: move interval to class level and clear on dispose
1 parent 9659dd8 commit 86de75d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/inbox.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class Inbox implements vscode.Disposable {
1919
#socket: WebSocket
2020
#messageCount = 0
2121
#workspaceId: string
22+
#memoryInterval: NodeJS.Timeout
2223

2324
constructor(workspace: Workspace, httpAgent: ProxyAgent, restClient: Api, storage: Storage) {
2425
const logger = getMemoryLogger()
@@ -96,12 +97,12 @@ export class Inbox implements vscode.Disposable {
9697
})
9798

9899
// Log memory stats periodically
99-
const memoryInterval = setInterval(
100+
this.#memoryInterval = setInterval(
100101
() => {
101102
if (!this.#disposed) {
102103
logger.logMemoryUsage("INBOX_PERIODIC")
103104
} else {
104-
clearInterval(memoryInterval)
105+
clearInterval(this.#memoryInterval)
105106
}
106107
},
107108
5 * 60 * 1000,
@@ -118,6 +119,8 @@ export class Inbox implements vscode.Disposable {
118119
this.#disposed = true
119120
logger.trackResourceDisposed("InboxWebSocket", this.#workspaceId)
120121
}
122+
123+
clearInterval(this.#memoryInterval)
121124
}
122125

123126
private notifyError(error: unknown) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy