Add context deadline to request

This commit is contained in:
Ben Sarmiento
2024-01-27 21:09:00 +01:00
parent 1aabcfd322
commit ce4b794098
4 changed files with 54 additions and 40 deletions

View File

@@ -58,12 +58,15 @@ func MainApp(configPath string) {
}
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)
var repairPool *ants.Pool
if config.EnableRepair() {
repairPool, err := ants.NewPool(1)
if err != nil {
zurglog.Errorf("Failed to create repair pool: %v", err)
os.Exit(1)
}
defer repairPool.Release()
}
defer repairPool.Release()
utils.EnsureDirExists("data") // Ensure the data directory exists
torrentMgr := torrent.NewTorrentManager(config, rd, workerPool, repairPool, log.Named("manager"))