Ignore errors when marking torrent as repaired (also mute warnings when under repair)
This commit is contained in:
@@ -262,9 +262,7 @@ func (t *TorrentManager) convertToTorrent(info *realdebrid.TorrentInfo) *Torrent
|
||||
}
|
||||
}
|
||||
torrent.UnassignedLinks = mapset.NewSet[string]()
|
||||
if err := torrent.State.Event(context.Background(), "mark_as_repaired"); err != nil {
|
||||
t.log.Errorf("Cannot repair torrent %s: %v", torrent.Hash, err)
|
||||
}
|
||||
torrent.State.Event(context.Background(), "mark_as_repaired")
|
||||
} else {
|
||||
torrent.UnassignedLinks = mapset.NewSet[string]()
|
||||
for _, link := range info.Links {
|
||||
@@ -361,9 +359,7 @@ func (t *TorrentManager) mergeTorrents(existing, toMerge *Torrent) *Torrent {
|
||||
})
|
||||
|
||||
if brokenCount == 0 && okCount > 0 {
|
||||
if err := mergedTorrent.State.Event(context.Background(), "mark_as_repaired"); err != nil {
|
||||
t.log.Errorf("Cannot repair torrent %s: %v", t, t.GetKey(mergedTorrent), err)
|
||||
}
|
||||
mergedTorrent.State.Event(context.Background(), "mark_as_repaired")
|
||||
}
|
||||
|
||||
return mergedTorrent
|
||||
|
||||
@@ -182,10 +182,7 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
||||
info, err := t.redownloadTorrent(torrent, []string{}) // reinsert the whole torrent, passing empty selection
|
||||
if info != nil && info.Progress == 100 && !t.isStillBroken(info, brokenFiles) {
|
||||
// successful repair
|
||||
if err := torrent.State.Event(context.Background(), "mark_as_repaired"); err != nil {
|
||||
t.log.Errorf("Cannot repair torrent %s: %v", torrent.Hash, err)
|
||||
return
|
||||
}
|
||||
torrent.State.Event(context.Background(), "mark_as_repaired")
|
||||
// delete old torrents
|
||||
torrent.DownloadedIDs.Each(func(torrentID string) bool {
|
||||
if torrentID != info.ID {
|
||||
@@ -202,7 +199,7 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.log.Warnf("Cannot repair torrent %s by redownloading all files (error=%s)", t.GetKey(torrent), err.Error())
|
||||
t.log.Warnf("Cannot repair torrent %s by redownloading all files (error=%v)", t.GetKey(torrent), err)
|
||||
} else {
|
||||
t.log.Warnf("Cannot repair torrent %s by redownloading all files", t.GetKey(torrent))
|
||||
}
|
||||
@@ -234,7 +231,7 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
||||
batchNum++
|
||||
redownloadedInfo, err := t.redownloadTorrent(torrent, group)
|
||||
if err != nil {
|
||||
t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%s) giving up", t.GetKey(torrent), err.Error())
|
||||
t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%v) giving up", t.GetKey(torrent), err)
|
||||
for _, newId := range newlyDownloadedIds {
|
||||
t.setToBinImmediately(newId)
|
||||
}
|
||||
@@ -250,7 +247,7 @@ func (t *TorrentManager) repair(torrent *Torrent) {
|
||||
if len(group) > 0 {
|
||||
redownloadedInfo, err := t.redownloadTorrent(torrent, group)
|
||||
if err != nil {
|
||||
t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%s) giving up", t.GetKey(torrent), err.Error())
|
||||
t.log.Warnf("Cannot repair torrent %s by downloading broken files (error=%v) giving up", t.GetKey(torrent), err)
|
||||
for _, newId := range newlyDownloadedIds {
|
||||
t.setToBinImmediately(newId)
|
||||
}
|
||||
@@ -353,9 +350,7 @@ func (t *TorrentManager) assignLinks(torrent *Torrent) bool {
|
||||
torrent.UnassignedLinks = mapset.NewSet[string]()
|
||||
t.markAsUnfixable(torrent, "rar'ed by RD")
|
||||
t.markAsUnplayable(torrent, "rar'ed by RD")
|
||||
if err := torrent.State.Event(context.Background(), "mark_as_repaired"); err != nil {
|
||||
t.log.Errorf("Cannot repair torrent %s: %v", torrent.Hash, err)
|
||||
}
|
||||
torrent.State.Event(context.Background(), "mark_as_repaired")
|
||||
}
|
||||
return false // end repair
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user