feat: migrating repacks to a worker

This commit is contained in:
Chubby Granny Chaser 2024-06-03 14:34:02 +01:00
parent eb3eb88f23
commit 5a85033486
No known key found for this signature in database
19 changed files with 204 additions and 147 deletions

View file

@ -1,8 +1,13 @@
import { DownloadManager, SearchEngine, startMainLoop } from "./services";
import { gameRepository, userPreferencesRepository } from "./repository";
import { DownloadManager, startMainLoop } from "./services";
import {
gameRepository,
repackRepository,
userPreferencesRepository,
} from "./repository";
import { UserPreferences } from "./entity";
import { RealDebridClient } from "./services/real-debrid";
import { Not } from "typeorm";
import { repacksWorker } from "./workers";
startMainLoop();
@ -21,7 +26,16 @@ const loadState = async (userPreferences: UserPreferences | null) => {
});
if (game) DownloadManager.startDownload(game);
await SearchEngine.updateRepacks();
repackRepository
.find({
order: {
createdAt: "DESC",
},
})
.then((repacks) => {
repacksWorker.run(repacks, { name: "setRepacks" });
});
};
userPreferencesRepository