Add library update hook on repair all
This commit is contained in:
@@ -9,9 +9,8 @@ import (
|
||||
|
||||
func (t *TorrentManager) RepairAll() {
|
||||
_ = t.repairWorker.Submit(func() {
|
||||
t.log.Info("Checking for torrents to repair")
|
||||
t.repairAll()
|
||||
t.log.Info("Finished checking for torrents to repair")
|
||||
t.log.Debug("Finished repairing all torrents")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,10 +26,16 @@ func (t *TorrentManager) repairAll() {
|
||||
}
|
||||
})
|
||||
t.log.Debugf("Found %d torrents to repair", len(toRepair))
|
||||
var updatedPaths []string
|
||||
for i := range toRepair {
|
||||
t.log.Infof("Repairing %s", toRepair[i].AccessKey)
|
||||
t.repair(toRepair[i])
|
||||
torrent := toRepair[i]
|
||||
t.log.Infof("Repairing %s", torrent.AccessKey)
|
||||
t.repair(torrent)
|
||||
t.assignedDirectoryCb(torrent, func(directory string) {
|
||||
updatedPaths = append(updatedPaths, fmt.Sprintf("%s/%s", directory, torrent.AccessKey))
|
||||
})
|
||||
}
|
||||
t.TriggerHookOnLibraryUpdate(updatedPaths)
|
||||
}
|
||||
|
||||
func (t *TorrentManager) Repair(torrent *Torrent) {
|
||||
@@ -205,7 +210,6 @@ func (t *TorrentManager) canCapacityHandle() bool {
|
||||
}
|
||||
|
||||
if count.DownloadingCount < count.MaxNumberOfTorrents {
|
||||
// t.log.Infof("We can still add a new torrent, we have capacity for %d more", count.MaxNumberOfTorrents-count.DownloadingCount)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user