Fixes on merge behavior; remove downloads cap
This commit is contained in:
@@ -194,6 +194,7 @@ func (rd *RealDebrid) GetTorrents(onlyOne bool) ([]Torrent, int, error) {
|
||||
for i := 0; i < maxParallelThreads; i++ {
|
||||
res := <-allResults
|
||||
if res.err != nil {
|
||||
rd.log.Warnf("Ignoring error when fetching torrents: %v", res.err)
|
||||
continue
|
||||
}
|
||||
allTorrents = append(allTorrents, res.torrents...)
|
||||
@@ -362,8 +363,6 @@ func (rd *RealDebrid) GetDownloads() []Download {
|
||||
return nil
|
||||
}
|
||||
|
||||
maxItems := rd.cfg.GetDownloadsLimit()
|
||||
|
||||
// reset allDownloads
|
||||
allDownloads := []Download{}
|
||||
page := 1
|
||||
@@ -401,18 +400,15 @@ func (rd *RealDebrid) GetDownloads() []Download {
|
||||
res := <-allResults
|
||||
err := <-errChan
|
||||
if err != nil {
|
||||
return allDownloads
|
||||
rd.log.Warnf("Ignoring error when fetching downloads: %v", err)
|
||||
continue
|
||||
}
|
||||
allDownloads = append(allDownloads, res...)
|
||||
}
|
||||
|
||||
rd.log.Debugf("Got %d/%d downloads", len(allDownloads), totalCount)
|
||||
|
||||
if len(allDownloads) >= totalCount || page >= maxPages || len(allDownloads) >= maxItems {
|
||||
if len(allDownloads) > maxItems {
|
||||
rd.log.Debugf("Capping it to %d downloads", len(allDownloads))
|
||||
allDownloads = allDownloads[:maxItems]
|
||||
}
|
||||
if len(allDownloads) >= totalCount || page >= maxPages {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user