Small repairs on logic
This commit is contained in:
@@ -59,7 +59,7 @@ func (rd *RealDebrid) GetTorrents(onlyOne bool) ([]Torrent, int, error) {
|
||||
result := <-allResults
|
||||
if result.err != nil {
|
||||
rd.log.Warnf("Ignoring error when fetching torrents pg %d: %v", result.page, result.err)
|
||||
continue
|
||||
return nil, 0, result.err
|
||||
}
|
||||
bIdx := (result.page - 1) % maxParallelThreads
|
||||
batches[bIdx] = []Torrent{}
|
||||
@@ -71,7 +71,7 @@ func (rd *RealDebrid) GetTorrents(onlyOne bool) ([]Torrent, int, error) {
|
||||
cIdxEnd := cachedCount - 1 - cIdx
|
||||
for tIdx, torrent := range batch { // 250 torrents
|
||||
tIdxEnd := indexFromEnd(tIdx, page+bIdx, pageSize, result.total)
|
||||
if torrent.ID == cached.ID && tIdxEnd == cIdxEnd {
|
||||
if torrent.ID == cached.ID && torrent.Progress == cached.Progress && tIdxEnd == cIdxEnd {
|
||||
allTorrents = append(allTorrents, batch[:tIdx]...)
|
||||
allTorrents = append(allTorrents, rd.torrentsCache[cIdx:]...)
|
||||
rd.log.Debugf("Got %d/%d torrents", len(allTorrents), result.total)
|
||||
|
||||
Reference in New Issue
Block a user