mirror of
https://github.com/snobu/destreamer.git
synced 2026-02-03 05:42:19 +00:00
added debug statement
This commit is contained in:
@@ -54,10 +54,12 @@ export class DownloadManager {
|
|||||||
*/
|
*/
|
||||||
public async init(options?: {[option: string]: string}): Promise<void> {
|
public async init(options?: {[option: string]: string}): Promise<void> {
|
||||||
let tries = 0;
|
let tries = 0;
|
||||||
|
const limit = 5;
|
||||||
|
|
||||||
while (this.webSocket.readyState !== this.webSocket.OPEN) {
|
while (this.webSocket.readyState !== this.webSocket.OPEN) {
|
||||||
if (tries < 5) {
|
if (tries < limit) {
|
||||||
tries++;
|
tries++;
|
||||||
|
logger.debug(`[DownloadMangaer] Trying to connect to aria deamon ${tries}/${limit}`);
|
||||||
await new Promise(r => setTimeout(r, 2000));
|
await new Promise(r => setTimeout(r, 2000));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -72,11 +74,7 @@ export class DownloadManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// FIXME: implement this (https://aria2.github.io/manual/en/html/aria2c.html#aria2.shutdown)
|
||||||
* Wait for an established connection between the webSocket
|
|
||||||
* and Aria2c with a 10s timeout.
|
|
||||||
* Then send aria2c the global config option specified.
|
|
||||||
*/
|
|
||||||
public async close(): Promise<void> {
|
public async close(): Promise<void> {
|
||||||
let tries = 0;
|
let tries = 0;
|
||||||
this.webSocket.close();
|
this.webSocket.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user