Continue on delete failure for bins
This commit is contained in:
@@ -89,8 +89,7 @@ func (t *TorrentManager) setXToBinOnceYDone(deleteId, completeId string) {
|
||||
func (t *TorrentManager) binImmediately(torrentId string) bool {
|
||||
if t.ImmediateBin.Contains(torrentId) {
|
||||
if err := t.api.DeleteTorrent(torrentId); err != nil {
|
||||
t.repairLog.Errorf("Failed to delete torrent %s: %v", torrentId, err)
|
||||
return false
|
||||
t.repairLog.Warnf("Failed to delete torrent %s: %v", torrentId, err)
|
||||
}
|
||||
t.ImmediateBin.Remove(torrentId)
|
||||
t.persistBins()
|
||||
@@ -109,8 +108,7 @@ func (t *TorrentManager) binOnceDoneErrorCheck(torrentId, status string) bool {
|
||||
func (t *TorrentManager) binOnceDone(torrentId string) bool {
|
||||
if t.OnceDoneBin.Contains(torrentId) {
|
||||
if err := t.api.DeleteTorrent(torrentId); err != nil {
|
||||
t.repairLog.Errorf("Failed to delete torrent %s: %v", torrentId, err)
|
||||
return false
|
||||
t.repairLog.Warnf("Failed to delete torrent %s: %v", torrentId, err)
|
||||
}
|
||||
t.OnceDoneBin.Remove(torrentId)
|
||||
t.persistBins()
|
||||
@@ -122,23 +120,17 @@ func (t *TorrentManager) binOnceDone(torrentId string) bool {
|
||||
if !t.OnceDoneBin.Contains(specialCase) {
|
||||
return false
|
||||
}
|
||||
|
||||
hasError := false
|
||||
t.OnceDoneBin.Clone().Each(func(entry string) bool {
|
||||
if strings.Contains(entry, specialCase) {
|
||||
idToDelete := strings.Split(entry, "-")[1]
|
||||
if err := t.api.DeleteTorrent(idToDelete); err != nil {
|
||||
t.repairLog.Errorf("Failed to delete torrent %s: %v", idToDelete, err)
|
||||
hasError = true
|
||||
return true
|
||||
t.repairLog.Warnf("Failed to delete torrent %s: %v", idToDelete, err)
|
||||
}
|
||||
t.OnceDoneBin.Remove(entry)
|
||||
}
|
||||
return false
|
||||
})
|
||||
if !hasError {
|
||||
t.OnceDoneBin.Remove(specialCase)
|
||||
}
|
||||
t.OnceDoneBin.Remove(specialCase)
|
||||
t.persistBins()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -67,12 +67,10 @@ func (t *TorrentManager) invokeRepair(torrent *Torrent) {
|
||||
t.repairRunningMu.Unlock()
|
||||
|
||||
// before we let go, let's check repairQueue
|
||||
t.workerPool.Submit(func() {
|
||||
queuedTorrent, exists := t.repairQueue.Pop()
|
||||
if exists {
|
||||
t.TriggerRepair(queuedTorrent)
|
||||
}
|
||||
})
|
||||
queuedTorrent, exists := t.repairQueue.Pop()
|
||||
if exists {
|
||||
t.TriggerRepair(queuedTorrent)
|
||||
}
|
||||
}
|
||||
|
||||
// TriggerRepair allows an on-demand repair to be initiated.
|
||||
|
||||
Reference in New Issue
Block a user