-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add handling for HTTP 429 (rate limiting) #92
Conversation
As of October 2020, trakt.tv started implementing rate limits. If rate limit is exceeded, HTTP 429 status is returned. trakt/api-help#220
4 similar comments
Why would you want to retry, if you exceed the rate limit? That's only going to make it worse. |
They have two kind of limits: The GET limit is something you are unlikely to hit. |
hrm, we usually create chunks of elements in the kodi addon. do you know how many items you were sending? I actually think you ran into an oversight. https://github.com/trakt/script.trakt/blob/master/resources/lib/syncEpisodes.py#L299 I probably used that to test, when I implemented the chunking for collections here trakt/script.trakt@2329cd0 but forgot to remove it (set it to 50 or more) |
I don't believe this would be the best way to handle 429 responses. While the GET limit is unlikely to be hit by most users, a rogue application that does hit this limit would amplify its requests to the Trakt API until Ideally, requests should be queued once a rate limit is hit and processed at the allowed rate for the endpoint. I'll take a look at this when I have some time available. |
I agree, that it is not the best possible solution to deal with the request limit. With the implementation as it was, I have not been able to sync the "seen" state with the script.trakt plugin (which makes use of trakt.py) from trakt.tv to a fresh set up Kodi with a bigger tv-show collection. The "as is" implementation is not respecting the limit in any way and is sending fresh requests immediately again after hitting the limit, which will most likely fail too. So, yes. It might be, that this should be solved in the script.trakt plugin, or that a queueing mechanism in trakt.py is the better solution. Nevertheless I am thankful for your work and happy that I could raise awareness of the 429 issue. |
For future reference, I fixed the chunk size as a start trakt/script.trakt@5f23288 |
As of October 2020, trakt.tv started implementing rate limits.
If rate limit is exceeded, HTTP 429 status is returned.
additional information: trakt/api-help#220
related issue: ##86