Do not redo repairs

This commit is contained in:
Ben Sarmiento
2023-11-30 01:36:45 +01:00
parent 8de52786ce
commit 253b92a3b6
4 changed files with 11 additions and 6 deletions

View File

@@ -610,6 +610,7 @@ func (t *TorrentManager) repairAll() {
unselected := 0
torrent.SelectedFiles.IterCb(func(_ string, file *File) {
if file.Link == "repair" && !forRepair {
file.Link = "repairing"
t.log.Debugf("Found a file to repair for torrent %s", torrent.AccessKey)
forRepair = true
}
@@ -646,7 +647,6 @@ func (t *TorrentManager) Delete(accessKey string) {
torrents.Remove(accessKey)
}
})
t.updateSortedKeys()
}
func (t *TorrentManager) Repair(accessKey string) {
@@ -698,7 +698,7 @@ func (t *TorrentManager) Repair(accessKey string) {
t.DirectoryMap.IterCb(func(_ string, torrents cmap.ConcurrentMap[string, *Torrent]) {
torrents.Remove(torrent.AccessKey)
})
t.updateSortedKeys()
t.SetNewLatestState(EmptyState())
// t.log.Debugf("You can try fixing it yourself magnet:?xt=urn:btih:%s", info.Hash)
return
} else if streamableCount == 1 {
@@ -707,7 +707,7 @@ func (t *TorrentManager) Repair(accessKey string) {
t.DirectoryMap.IterCb(func(_ string, torrents cmap.ConcurrentMap[string, *Torrent]) {
torrents.Remove(torrent.AccessKey)
})
t.updateSortedKeys()
t.SetNewLatestState(EmptyState())
return
}
// t.log.Debugf("Identified the expired files of torrent id=%s", info.ID)
@@ -894,9 +894,9 @@ func (t *TorrentManager) updateSortedKeys() {
}
davRet = "<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">" + dav.BaseDirectory(directory, "") + dav.BaseDirectory(directory, "") + davRet + "</d:multistatus>"
t.ResponseCache.Set(directory+".dav", davRet, 0)
t.ResponseCache.Set(directory+".dav", davRet, 1)
htmlRet = "<ol>" + htmlRet
t.ResponseCache.Set(directory+".html", "<ol>"+htmlRet, 0)
t.ResponseCache.Set(directory+".html", "<ol>"+htmlRet, 1)
})
}