Skip to content

Commit dcda430

Browse files
committed
Add dispose method to FastTracker
1 parent 21dc86c commit dcda430

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/fast-tracker.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ export class FastTracker<ConnectionContext extends Record<string, unknown>>
157157
}
158158

159159
private startClearPeersInterval(): void {
160-
if (this.#clearPeersInterval !== undefined) {
161-
clearInterval(this.#clearPeersInterval);
162-
this.#clearPeersInterval = undefined;
163-
}
164-
165160
this.#clearPeersInterval = setInterval(() => {
166161
const now = performance.now();
167162
for (const peer of this.#peers.values()) {
@@ -499,6 +494,10 @@ export class FastTracker<ConnectionContext extends Record<string, unknown>>
499494

500495
this.sendMessage({ action: "scrape", files }, connection);
501496
}
497+
498+
public dispose() {
499+
clearInterval(this.#clearPeersInterval);
500+
}
502501
}
503502

504503
function getSendOfferJson(

0 commit comments

Comments
 (0)