From 122ab19b7b649ee364ec415b26a525fda2989957 Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Sat, 17 Feb 2024 04:40:13 +0100 Subject: [PATCH] Trigger repair on initial run --- internal/torrent/manager.go | 1 + internal/torrent/refresh.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/internal/torrent/manager.go b/internal/torrent/manager.go index 6c2b6b1..4220189 100644 --- a/internal/torrent/manager.go +++ b/internal/torrent/manager.go @@ -68,6 +68,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, w t.setNewLatestState(t.getCurrentState()) t.StartRefreshJob() t.StartRepairJob() + t.TriggerRepair(nil) }) t.workerPool.Submit(func() { t.mountDownloads() diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index 7dbf584..f2ff66e 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -141,9 +141,11 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent { if torrentFromCache, exists := infoCache.Get(rdTorrent.ID); exists && !torrentFromCache.AnyInProgress() && torrentFromCache.SelectedFiles.Count() == len(rdTorrent.Links) { + return torrentFromCache } else if !exists { + torrentFromFile := t.readTorrentFromFile(rdTorrent.ID) if torrentFromFile != nil &&