1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-17 05:22:18 +00:00

added debug statement

This commit is contained in:
Luca Armaroli
2020-09-19 23:29:44 +02:00
parent 6c8628e5e1
commit 7cab44a2e4

View File

@@ -54,10 +54,12 @@ export class DownloadManager {
*/
public async init(options?: {[option: string]: string}): Promise<void> {
let tries = 0;
const limit = 5;
while (this.webSocket.readyState !== this.webSocket.OPEN) {
if (tries < 5) {
if (tries < limit) {
tries++;
logger.debug(`[DownloadMangaer] Trying to connect to aria deamon ${tries}/${limit}`);
await new Promise(r => setTimeout(r, 2000));
}
else {
@@ -72,11 +74,7 @@ export class DownloadManager {
}
}
/**
* Wait for an established connection between the webSocket
* and Aria2c with a 10s timeout.
* Then send aria2c the global config option specified.
*/
// FIXME: implement this (https://aria2.github.io/manual/en/html/aria2c.html#aria2.shutdown)
public async close(): Promise<void> {
let tries = 0;
this.webSocket.close();