mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
feat: restart downloads and move seed process initiation to main.ts
This commit is contained in:
parent
65b1ec9b1f
commit
3aa8230e17
@ -1,11 +1,13 @@
|
||||
import { Ludusavi, startMainLoop } from "./services";
|
||||
import { userPreferencesRepository } from "./repository";
|
||||
import { DownloadManager, Ludusavi, startMainLoop } from "./services";
|
||||
import { downloadQueueRepository, userPreferencesRepository } from "./repository";
|
||||
import { UserPreferences } from "./entity";
|
||||
import { RealDebridClient } from "./services/download/real-debrid";
|
||||
import { HydraApi } from "./services/hydra-api";
|
||||
import { uploadGamesBatch } from "./services/library-sync";
|
||||
import { PythonRPC } from "./services/python-rpc";
|
||||
import { Aria2 } from "./services/aria2";
|
||||
import { startSeedProcess } from "./services/seed";
|
||||
import { sleep } from "./helpers";
|
||||
|
||||
const loadState = async (userPreferences: UserPreferences | null) => {
|
||||
import("./events");
|
||||
@ -22,7 +24,26 @@ const loadState = async (userPreferences: UserPreferences | null) => {
|
||||
uploadGamesBatch();
|
||||
});
|
||||
|
||||
|
||||
const [nextQueueItem] = await downloadQueueRepository.find({
|
||||
order: {
|
||||
id: "DESC",
|
||||
},
|
||||
relations: {
|
||||
game: true,
|
||||
},
|
||||
});
|
||||
|
||||
PythonRPC.spawn();
|
||||
await sleep(1000);
|
||||
// wait for python process to start
|
||||
|
||||
if (nextQueueItem?.game.status === "active") {
|
||||
DownloadManager.startDownload(nextQueueItem.game);
|
||||
}
|
||||
|
||||
await startSeedProcess();
|
||||
|
||||
startMainLoop();
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,6 @@ import crypto from "node:crypto";
|
||||
import { logger } from "./logger";
|
||||
import { Readable } from "node:stream";
|
||||
import { app, dialog } from "electron";
|
||||
import { startSeedProcess } from "./seed";
|
||||
|
||||
const binaryNameByPlatform: Partial<Record<NodeJS.Platform, string>> = {
|
||||
darwin: "hydra-python-rpc",
|
||||
@ -84,8 +83,6 @@ export class PythonRPC {
|
||||
this.logStderr(childProcess.stderr);
|
||||
|
||||
this.pythonProcess = childProcess;
|
||||
|
||||
startSeedProcess();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,8 @@ export const startSeedProcess = async () => {
|
||||
|
||||
if (seedList.length === 0) return;
|
||||
|
||||
await sleep(1000);
|
||||
// wait for python process to start
|
||||
|
||||
seedList.map(async (game) => {
|
||||
await DownloadManager.startDownload(game);
|
||||
await sleep(100);
|
||||
await sleep(300);
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user