From 2ff754e06ee132b5f3679315dcb5654e332c64e0 Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Fri, 19 Apr 2024 11:41:12 +0200 Subject: [PATCH] Change some logs --- internal/torrent/repair.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index c378a90..9869e13 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -218,6 +218,7 @@ func (t *TorrentManager) repair(torrent *Torrent) { t.fixerAddCommand(redownloadedInfo.ID, "repaired") return } + t.log.Error("This is not supposed to happen, we should have repaired the torrent by now") } t.log.Infof("Repairing by downloading 2 batches of the broken %d files of torrent %s", len(brokenFiles), t.GetKey(torrent)) @@ -395,7 +396,7 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection string) ( } // documented status: magnet_error, magnet_conversion, waiting_files_selection, queued, downloading, downloaded, error, virus, compressing, uploading, dead - okStatuses := []string{"magnet_conversion", "waiting_files_selection", "queued", "downloading", "downloaded", "uploading"} + okStatuses := []string{"downloading", "downloaded", "uploading"} // not compressing because we need playable files isOkStatus := false for _, status := range okStatuses { @@ -405,8 +406,8 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection string) ( } } if !isOkStatus { - t.fixerAddCommand(newTorrentID, "download_failed") - return nil, fmt.Errorf("the redownloaded torrent %s (id=%s) is in error state: %s", t.GetKey(torrent), newTorrentID, info.Status) + t.fixerAddCommand(info.ID, "download_failed") + return nil, fmt.Errorf("the redownloaded torrent %s (id=%s) is in a non-OK state: %s", t.GetKey(torrent), info.ID, info.Status) } // check if incorrect number of links @@ -416,7 +417,7 @@ func (t *TorrentManager) redownloadTorrent(torrent *Torrent, selection string) ( return nil, fmt.Errorf("it did not fix the issue for %s (id=%s), only got %d files but we need %d, undoing", t.GetKey(torrent), info.ID, len(info.Links), selectionCount) } - t.log.Infof("Redownloading torrent %s successful (progress=%d)", t.GetKey(torrent), info.Progress) + t.log.Infof("Redownloading torrent %s successful (id=%s, progress=%d)", t.GetKey(torrent), info.ID, info.Progress) for _, id := range oldTorrentIDs { t.fixerAddCommand(id, "replaced") }