Removed 2 hour timer from YT Stream

This commit is contained in:
killer069 2021-10-01 11:25:53 +05:30
parent 4f49d16b16
commit 144b247cc9

View File

@ -130,7 +130,6 @@ export class Stream {
private per_sec_bytes: number; private per_sec_bytes: number;
private content_length: number; private content_length: number;
private video_url: string; private video_url: string;
private timer: NodeJS.Timer | null;
private cookie: string; private cookie: string;
private data_ended: boolean; private data_ended: boolean;
private playing_count: number; private playing_count: number;
@ -154,9 +153,6 @@ export class Stream {
this.bytes_count = 0; this.bytes_count = 0;
this.video_url = video_url; this.video_url = video_url;
this.cookie = cookie; this.cookie = cookie;
this.timer = setInterval(() => {
this.retry();
}, 7200 * 1000);
this.per_sec_bytes = Math.ceil(contentLength / duration); this.per_sec_bytes = Math.ceil(contentLength / duration);
this.content_length = contentLength; this.content_length = contentLength;
this.request = null; this.request = null;
@ -187,10 +183,8 @@ export class Stream {
} }
private cleanup() { private cleanup() {
clearInterval(this.timer as NodeJS.Timer);
this.request?.unpipe(this.stream); this.request?.unpipe(this.stream);
this.request?.destroy(); this.request?.destroy();
this.timer = null;
this.request = null; this.request = null;
this.url = ''; this.url = '';
} }
@ -218,11 +212,6 @@ export class Stream {
this.cleanup(); this.cleanup();
await this.retry(); await this.retry();
this.loop(); this.loop();
if (!this.timer) {
this.timer = setInterval(() => {
this.retry();
}, 7200 * 1000);
}
return; return;
} }
this.request = stream; this.request = stream;
@ -232,11 +221,6 @@ export class Stream {
this.cleanup(); this.cleanup();
await this.retry(); await this.retry();
this.loop(); this.loop();
if (!this.timer) {
this.timer = setInterval(() => {
this.retry();
}, 7200 * 1000);
}
}); });
stream.on('data', (chunk: any) => { stream.on('data', (chunk: any) => {