Assign links outside repair

This commit is contained in:
Ben Adrian Sarmiento
2024-06-05 10:37:38 +02:00
parent c62cdeace8
commit fa26553933
4 changed files with 33 additions and 20 deletions

View File

@@ -156,6 +156,14 @@ func (t *TorrentManager) refreshTorrents() []string {
})
})
t.workerPool.Submit(func() {
allTorrents.IterCb(func(accessKey string, torrent *Torrent) {
if torrent.UnassignedLinks.Cardinality() > 0 {
t.assignLinks(torrent)
}
})
})
return updatedPaths.ToSlice()
}

View File

@@ -164,10 +164,6 @@ func (t *TorrentManager) Repair(torrent *Torrent, wg *sync.WaitGroup) {
func (t *TorrentManager) repair(torrent *Torrent) {
t.repairLog.Infof("Started repair process for torrent %s (ids=%v)", t.GetKey(torrent), torrent.DownloadedIDs.ToSlice())
if torrent.UnassignedLinks.Cardinality() > 0 && !t.assignLinks(torrent) {
return
}
// check for other broken files
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
if !file.State.Is("ok_file") {