Memory Leak fixed
This commit is contained in:
parent
ae47630065
commit
0ef36affa2
@ -157,6 +157,7 @@ export class Stream {
|
|||||||
this.loop();
|
this.loop();
|
||||||
}, 265);
|
}, 265);
|
||||||
this.stream.on('close', () => {
|
this.stream.on('close', () => {
|
||||||
|
this.timer.destroy()
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
});
|
});
|
||||||
this.loop();
|
this.loop();
|
||||||
@ -197,6 +198,7 @@ export class Stream {
|
|||||||
if (Number(stream.statusCode) >= 400) {
|
if (Number(stream.statusCode) >= 400) {
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
await this.retry();
|
await this.retry();
|
||||||
|
this.timer.reuse()
|
||||||
this.loop();
|
this.loop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -206,6 +208,7 @@ export class Stream {
|
|||||||
stream.once('error', async (err) => {
|
stream.once('error', async (err) => {
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
await this.retry();
|
await this.retry();
|
||||||
|
this.timer.reuse()
|
||||||
this.loop();
|
this.loop();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -216,6 +219,7 @@ export class Stream {
|
|||||||
stream.on('end', () => {
|
stream.on('end', () => {
|
||||||
if (end >= this.content_length) {
|
if (end >= this.content_length) {
|
||||||
this.timer.destroy();
|
this.timer.destroy();
|
||||||
|
this.cleanup()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user