From 2b6f0f95a8d5c0ad128cf2a31b618bc8bc6ae3db Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Wed, 24 Jan 2024 06:23:39 +0100 Subject: [PATCH] Add logs for what is added on repair list --- internal/torrent/repair.go | 8 +++++++- internal/torrent/uncached.go | 1 + internal/universal/downloader.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index c70dba6..5669895 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -50,8 +50,14 @@ func (t *TorrentManager) repairAll() { return } }) + if hasBrokenFiles { + t.log.Debugf("Torrent %s has broken files, adding to repair list", t.GetKey(torrent)) + toRepair.Add(torrent) + } - if hasBrokenFiles || torrent.UnassignedLinks.Cardinality() > 0 { + // check 3: for expired links + if torrent.UnassignedLinks.Cardinality() > 0 { + t.log.Debugf("Torrent %s has unassigned links, adding to repair list", t.GetKey(torrent)) toRepair.Add(torrent) } }) diff --git a/internal/torrent/uncached.go b/internal/torrent/uncached.go index c2717ee..f3097a8 100644 --- a/internal/torrent/uncached.go +++ b/internal/torrent/uncached.go @@ -51,6 +51,7 @@ func (t *TorrentManager) getUncachedTorrents() ([]*Torrent, error) { } if _, ok := availabilityChecks[torrent.Hash]; !ok || !availabilityChecks[torrent.Hash] { + t.log.Debugf("Torrent %s is no longer cached, adding to repair list", t.GetKey(torrent)) uncachedTorrents = append(uncachedTorrents, torrent) } }) diff --git a/internal/universal/downloader.go b/internal/universal/downloader.go index e08f438..572166a 100644 --- a/internal/universal/downloader.go +++ b/internal/universal/downloader.go @@ -157,7 +157,7 @@ func (dl *Downloader) streamFileToResponse(torrent *intTor.Torrent, file *intTor } if torrent != nil { - log.Debugf("Downloading file %s from torrent %s (%s)%s", file.Path, torrent.Name, unrestrict.Link, rangeLog) + log.Debugf("Downloading file %s from torrent %s (%s)%s", file.Path, torMgr.GetKey(torrent), unrestrict.Link, rangeLog) } else { log.Debugf("Downloading file %s (%s)%s", file.Path, unrestrict.Link, rangeLog) }