Init torepair set properly
This commit is contained in:
@@ -28,7 +28,7 @@ func (t *TorrentManager) repairAll() {
|
||||
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
|
||||
|
||||
// collect all torrents that need to be repaired
|
||||
var toRepair mapset.Set[*Torrent]
|
||||
toRepair := mapset.NewSet[*Torrent]()
|
||||
|
||||
allTorrents.IterCb(func(_ string, torrent *Torrent) {
|
||||
if torrent.AnyInProgress() || torrent.UnrepairableReason != "" {
|
||||
@@ -80,12 +80,17 @@ func (t *TorrentManager) repairAll() {
|
||||
return
|
||||
}
|
||||
})
|
||||
t.log.Debugf("Found %d broken torrents to repair in total", toRepair.Cardinality())
|
||||
|
||||
toRepair.Each(func(torrent *Torrent) bool {
|
||||
t.Repair(torrent)
|
||||
return false
|
||||
})
|
||||
if toRepair.Cardinality() == 0 {
|
||||
t.log.Info("Periodic repair found no broken torrents to repair")
|
||||
} else {
|
||||
t.log.Debugf("Periodic repair found %d broken torrents to repair in total", toRepair.Cardinality())
|
||||
|
||||
toRepair.Each(func(torrent *Torrent) bool {
|
||||
t.Repair(torrent)
|
||||
return false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TorrentManager) Repair(torrent *Torrent) {
|
||||
|
||||
Reference in New Issue
Block a user