Fixers and repairs

This commit is contained in:
Ben Sarmiento
2024-01-19 03:02:21 +01:00
parent c0b9fc8c55
commit 7b1e34c705
4 changed files with 35 additions and 17 deletions

View File

@@ -104,11 +104,11 @@ func (t *TorrentManager) Repair(torrent *Torrent) {
t.log.Warnf("Torrent %s is unfixable, skipping repair", t.GetKey(torrent))
return
}
if t.Repairs.Contains(t.GetKey(torrent)) {
if t.repairs.Contains(t.GetKey(torrent)) {
t.log.Warnf("Torrent %s is already being repaired, skipping repair", t.GetKey(torrent))
return
}
t.Repairs.Add(t.GetKey(torrent))
t.repairs.Add(t.GetKey(torrent))
// save the broken files to the file cache
infoCache, _ := t.DirectoryMap.Get(INT_INFO_CACHE)
torrent.DownloadedIDs.Each(func(id string) bool {
@@ -126,7 +126,7 @@ func (t *TorrentManager) Repair(torrent *Torrent) {
})
_ = t.workerPool.Submit(func() {
t.repair(torrent)
t.Repairs.Remove(t.GetKey(torrent))
t.repairs.Remove(t.GetKey(torrent))
})
}
@@ -312,7 +312,7 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, brokenFiles string)
t.Api.DeleteTorrent(id)
}
} else {
t.onlyForRepair.Set(newTorrentID, torrent)
t.fixers.Set(newTorrentID, torrent)
}
return info, nil
}
@@ -330,7 +330,7 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, brokenFiles string)
t.Api.DeleteTorrent(id)
}
} else {
t.onlyForRepair.Set(newTorrentID, torrent)
t.fixers.Set(newTorrentID, torrent)
}
return info, nil
}