Add rate limiter
This commit is contained in:
@@ -29,7 +29,7 @@ func (rd *RealDebrid) GetTorrents(onlyOne bool) ([]Torrent, int, error) {
|
||||
|
||||
allTorrents := []Torrent{}
|
||||
page := 1
|
||||
pageSize := 250
|
||||
pageSize := 500
|
||||
|
||||
maxPages := (totalElements + pageSize - 1) / pageSize
|
||||
rd.log.Debugf("Torrents total count is %d", totalElements)
|
||||
@@ -127,6 +127,8 @@ func (rd *RealDebrid) fetchPageOfTorrents(page, limit int) fetchTorrentsResult {
|
||||
}
|
||||
}
|
||||
|
||||
rd.torrentsRateLimiter.Wait()
|
||||
|
||||
resp, err := rd.apiClient.Do(req)
|
||||
if err != nil {
|
||||
rd.log.Errorf("Error when executing the get torrents request: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user