plex_debrid icon indicating copy to clipboard operation
plex_debrid copied to clipboard

Change to rate_limit

Open compil3 opened this issue 2 years ago • 0 comments

I've been told by providers that there are to many requests being sent to their API servers. Now I'm not sure if this due to me using Plex & Trakt being setup as Content Services and the fact I have everything sync'd from Plex to Trakt (moved from a previous setup to this one). They have told me that I have requested 8000 requests within a short time frame.

I did some digging and found GET_RATE_LIMIT is set to 5 seconds which is causing it to spam their APIs. I think 1 of 2 things would make this situation better to avoid providers resource being slammed by users make a massive amount of requests in a short time frame. Here are some ideas on how to resolve it:

  1. Allow this setting to be user changeable: So if users are getting warning via providers they can increase the rate limit time.
  2. Automatically detect if there are more than 1 content services enabled outside of Plex watchlists, such that if Trakt for example is used, it will wait even longer to make GET requests to scrappers etc. Maybe add a flag to Content Services outside of Plex Watchlist to increase the rate limit.
  3. Change the way scraping works so that if content is found on one scrapper then it will not send a request to another and only trigger a request to other providers if nothing is found. THis would require I believe setting provider heirarchy (if X is list 1st, Y 2nd, Z 3rd) to search one at a time until something is found or nothing at all (returning nothing found). I haven't looked at the entire code base to see how it does it currently.

I've been speaking with a providers owner and he's willing to create a seperate API for Plex_Debrid, to lessen the request load that they are seeing from this, but I suspect other providers are seeing this as well.

https://github.com/itsToggle/plex_debrid/blob/244e5fc5b32b85f5c6413aee34a7664e4cfa3c20/base/init.py#L38

compil3 avatar Nov 05 '23 14:11 compil3