fix: removing repacks from worker threads to fix race condition

This commit is contained in:
Chubby Granny Chaser 2024-06-03 23:09:47 +01:00
parent 4559e23610
commit ea923d5082
No known key found for this signature in database
13 changed files with 71 additions and 105 deletions

View file

@ -1,18 +1,15 @@
import { DownloadManager, startMainLoop } from "./services";
import {
gameRepository,
repackRepository,
userPreferencesRepository,
} from "./repository";
import { DownloadManager, RepacksManager, startMainLoop } from "./services";
import { gameRepository, userPreferencesRepository } from "./repository";
import { UserPreferences } from "./entity";
import { RealDebridClient } from "./services/real-debrid";
import { Not } from "typeorm";
import { repacksWorker } from "./workers";
import { fetchDownloadSourcesAndUpdate } from "./helpers";
startMainLoop();
const loadState = async (userPreferences: UserPreferences | null) => {
await RepacksManager.updateRepacks();
import("./events");
if (userPreferences?.realDebridApiToken)
@ -28,14 +25,6 @@ const loadState = async (userPreferences: UserPreferences | null) => {
if (game) DownloadManager.startDownload(game);
const repacks = await repackRepository.find({
order: {
createdAt: "DESC",
},
});
repacksWorker.run(repacks, { name: "setRepacks" });
fetchDownloadSourcesAndUpdate();
};