Rename variables for easy reference
This commit is contained in:
@@ -92,19 +92,19 @@ func (t *TorrentManager) invokeRepair(torrent *Torrent) {
|
||||
}
|
||||
|
||||
func (t *TorrentManager) executeRepairJob(torrent *Torrent) {
|
||||
var haystack cmap.ConcurrentMap[string, *Torrent]
|
||||
var torrents cmap.ConcurrentMap[string, *Torrent]
|
||||
if torrent == nil {
|
||||
haystack, _ = t.DirectoryMap.Get(INT_ALL)
|
||||
torrents, _ = t.DirectoryMap.Get(INT_ALL)
|
||||
} else {
|
||||
haystack = cmap.New[*Torrent]()
|
||||
haystack.Set("", torrent)
|
||||
torrents = cmap.New[*Torrent]()
|
||||
torrents.Set("", torrent)
|
||||
}
|
||||
|
||||
// collect all torrents that need to be repaired asynchronously
|
||||
toRepair := mapset.NewSet[*Torrent]()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
haystack.IterCb(func(_ string, torrent *Torrent) {
|
||||
torrents.IterCb(func(_ string, torrent *Torrent) {
|
||||
wg.Add(1)
|
||||
// temp worker for finding broken torrents
|
||||
t.workerPool.Submit(func() {
|
||||
@@ -677,8 +677,8 @@ func (t *TorrentManager) ResetRepairState() {
|
||||
if !t.Config.EnableRepair() {
|
||||
return
|
||||
}
|
||||
allTorrents, _ := t.DirectoryMap.Get(INT_ALL)
|
||||
allTorrents.IterCb(func(_ string, torrent *Torrent) {
|
||||
torrents, _ := t.DirectoryMap.Get(INT_ALL)
|
||||
torrents.IterCb(func(_ string, torrent *Torrent) {
|
||||
err := torrent.State.Event(context.Background(), "reset_repair")
|
||||
if err == nil {
|
||||
t.repairLog.Debugf("Repair state of torrent %s has been reset", t.GetKey(torrent))
|
||||
|
||||
Reference in New Issue
Block a user