This commit is contained in:
Ben Sarmiento
2024-01-16 20:10:46 +01:00
parent 2cb29284f6
commit 727c694c02
5 changed files with 41 additions and 22 deletions

View File

@@ -24,11 +24,11 @@ func (t *TorrentManager) RefreshTorrents() []string {
for i := range instances {
idx := i
wg.Add(1)
_ = t.workerPool.Submit(func() {
defer wg.Done()
infoChan <- t.getMoreInfo(instances[idx])
})
wg.Add(1)
}
wg.Wait()
@@ -168,7 +168,6 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
OriginalName: info.OriginalName,
Added: info.Added,
Hash: info.Hash,
Lock: &sync.Mutex{},
}
// SelectedFiles is a subset of Files with only the selected ones
// it also has a Link field, which can be empty
@@ -234,7 +233,6 @@ func (t *TorrentManager) mergeToMain(existing, toMerge *Torrent) Torrent {
Unfixable: existing.Unfixable || toMerge.Unfixable,
UnassignedLinks: existing.UnassignedLinks.Union(toMerge.UnassignedLinks),
BrokenLinks: existing.BrokenLinks.Union(toMerge.BrokenLinks),
Lock: &sync.Mutex{},
}
// this function triggers only when we have a new DownloadedID