Hi,
I am having some issues with X-RateLimit-Remaining. It seems to be very erratic and is dropping randomly. I am doing a cooldown code which reacts to X-RateLimit-Remaining, the closer I am to zero to more cooldown I do. However, somtimes after a few calls I get the value drop below 15, one call later it goes below 10. I am doing a lot of cooldowns which, when added together give me way less than 40calls in 10sec window, so thats a problem.
I am trying to get an understanding of how rate limiter works, is it tied to the size of the result as well?
Thanks, /m
Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.
Vous souhaitez évaluer ou ajouter cet élément à une liste ?
Pas encore membre ?
Réponse de mmitrovic@gmail.com
le 7 novembre 2018 à 04h05
For example:
you see, the call count does not correspond to values I get from headers back. I am definitely the only one on this IP. Could this be an issue with your IP address grouping in limit calculation?
Réponse de mmitrovic@gmail.com
le 8 novembre 2018 à 07h12
Any news on this? This broken limiter is a real issue , with faulty remaining rates it took us 2h to process something it would take 30mins with 40calls per 10sec.
Réponse de Travis Bell
le 8 novembre 2018 à 19h27
Hi,
I'm not sure if I understand the issue you're describing 100%. So let's walk through this. When you make your first request, you'll get these 3 headers back:
The
X-RateLimit-Reset
header is saying when the current bucket will expire, and reset your count to 40. This is a rolling 10 second window that starts at the time you make the first request. So by looking at both of those headers you should know when to pause and resume your requests. Here's some mock Ruby code I threw together, and the subsequent run I let go for a minute or so. I am adding a 1 second buffer to my sleep since even though my computer and the server should be in sync, they could be slightly off.Does that help clear it up at all?
Réponse de mmitrovic@gmail.com
le 9 novembre 2018 à 07h15
Ah, ok, this acatually explains a lot. let me work this into y solution and see how it works now. I guess I was under the impression that the 10sec window was a rolling one.
Réponse de mmitrovic@gmail.com
le 9 novembre 2018 à 07h56
Ok, works now! Thanks.
Réponse de Travis Bell
le 9 novembre 2018 à 10h01
Perfect, happy to help!