diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index 246651d..804955e 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -134,14 +134,6 @@ func (t *TorrentManager) refreshTorrents() { } }) }) - - t.workerPool.Submit(func() { - allTorrents.IterCb(func(accessKey string, torrent *Torrent) { - if torrent.UnassignedLinks.Cardinality() > 0 { - t.assignLinks(torrent) - } - }) - }) } // StartRefreshJob periodically refreshes the torrents diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index 44a583d..986590c 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -165,6 +165,10 @@ 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") {