Final repair fixes

This commit is contained in:
Ben Sarmiento
2024-01-18 21:19:36 +01:00
parent 0a451cccde
commit 9472fae9fe
5 changed files with 28 additions and 20 deletions

View File

@@ -41,15 +41,22 @@ func MainApp(configPath string) {
premium.MonitorPremiumStatus(rd, zurglog)
p, err := ants.NewPool(config.GetNumOfWorkers() + 1)
workerPool, err := ants.NewPool(config.GetNumOfWorkers() + 1)
if err != nil {
zurglog.Errorf("Failed to create worker pool: %v", err)
os.Exit(1)
}
defer p.Release()
defer workerPool.Release()
repairPool, err := ants.NewPool(1, ants.WithMaxBlockingTasks(1))
if err != nil {
zurglog.Errorf("Failed to create repair pool: %v", err)
os.Exit(1)
}
defer repairPool.Release()
utils.EnsureDirExists("data") // Ensure the data directory exists
torrentMgr := torrent.NewTorrentManager(config, rd, p, log.Named("manager"))
torrentMgr := torrent.NewTorrentManager(config, rd, workerPool, repairPool, log.Named("manager"))
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), 0, true, config, log.Named("dlclient"))
downloader := universal.NewDownloader(downloadClient)