From 0ef36affa22ef1879639f3d100d7d6b1c54de81a Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Sat, 9 Oct 2021 11:51:37 +0530 Subject: [PATCH] Memory Leak fixed --- play-dl/YouTube/classes/LiveStream.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/play-dl/YouTube/classes/LiveStream.ts b/play-dl/YouTube/classes/LiveStream.ts index 0a2510d..7fee2ae 100644 --- a/play-dl/YouTube/classes/LiveStream.ts +++ b/play-dl/YouTube/classes/LiveStream.ts @@ -157,6 +157,7 @@ export class Stream { this.loop(); }, 265); this.stream.on('close', () => { + this.timer.destroy() this.cleanup(); }); this.loop(); @@ -197,6 +198,7 @@ export class Stream { if (Number(stream.statusCode) >= 400) { this.cleanup(); await this.retry(); + this.timer.reuse() this.loop(); return; } @@ -206,6 +208,7 @@ export class Stream { stream.once('error', async (err) => { this.cleanup(); await this.retry(); + this.timer.reuse() this.loop(); }); @@ -216,6 +219,7 @@ export class Stream { stream.on('end', () => { if (end >= this.content_length) { this.timer.destroy(); + this.cleanup() } }); }