mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 02:41:02 +00:00
feat: kill aria2c
This commit is contained in:
@@ -13,6 +13,7 @@ import { Game } from "@main/entity";
|
||||
import { startAria2 } from "./aria2c";
|
||||
import { sleep } from "@main/helpers";
|
||||
import { logger } from "./logger";
|
||||
import type { ChildProcess } from "node:child_process";
|
||||
|
||||
export class DownloadManager {
|
||||
private static downloads = new Map<number, string>();
|
||||
@@ -21,11 +22,12 @@ export class DownloadManager {
|
||||
private static gid: string | null = null;
|
||||
private static game: Game | null = null;
|
||||
private static realDebridTorrentId: string | null = null;
|
||||
private static aria2c: ChildProcess | null = null;
|
||||
|
||||
private static aria2 = new Aria2({});
|
||||
|
||||
private static async connect() {
|
||||
startAria2();
|
||||
this.aria2c = startAria2();
|
||||
|
||||
let retries = 0;
|
||||
|
||||
@@ -43,6 +45,12 @@ export class DownloadManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static disconnect() {
|
||||
if (this.aria2c) {
|
||||
this.aria2c.kill();
|
||||
}
|
||||
}
|
||||
|
||||
private static getETA(
|
||||
totalLength: number,
|
||||
completedLength: number,
|
||||
|
||||
Reference in New Issue
Block a user