Rigorous fix check

This commit is contained in:
Ben Sarmiento
2024-01-26 22:51:08 +01:00
parent 979151d2de
commit 52046cb3db
3 changed files with 8 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ func (t *TorrentManager) repairAll() {
toRepair := mapset.NewSet[*Torrent]()
allTorrents.IterCb(func(_ string, torrent *Torrent) {
if torrent.AnyInProgress() || torrent.UnrepairableReason != "" {
if torrent.AnyInProgress() || torrent.AllInProgress() || torrent.UnrepairableReason != "" {
return
}
@@ -102,7 +102,7 @@ func (t *TorrentManager) Repair(torrent *Torrent) {
t.log.Warnf("Torrent %s is already being repaired, skipping repair", t.GetKey(torrent))
return
}
if torrent.AnyInProgress() {
if torrent.AnyInProgress() || torrent.AllInProgress() {
t.log.Infof("Torrent %s is in progress, skipping repair until download is done", t.GetKey(torrent))
return
}
@@ -344,9 +344,12 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection string) (
if len(oldTorrentIDs) > 0 {
// replace the old torrent
infoCache, _ := t.DirectoryMap.Get(INT_INFO_CACHE)
for _, id := range oldTorrentIDs {
torrent.DownloadedIDs.Remove(id)
t.Api.DeleteTorrent(id)
t.deleteOnceDone.Add(id)
infoCache.Remove(id)
}
} else {
// it's a fixer