diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index 825c4c6..c1b5ab7 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -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) {