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