Replies: 1 comment 1 reply
-
Polly is typically reactive for upstream rate-limiting, we don't try to mirror the internal implementation of what is rate limiting you, but to just respond to feedback regarding it (e.g. retries based on the While we could try and allow you to sync the local view of any remote rate limiting, this would never be 100% accurate. It also doesn't work at all in the scenario of a load balanced application - in that scenario the rate limit is shared across your fleet. No one instance/container can know if it's about to exceed the limit unless it tries to do so, and similar might expect a request to succeed yet fail because some other instance used up the last of the rate limit for your client/IP/token. |
Beta Was this translation helpful? Give feedback.
-
I'm using an API that allows a certain number of requests per day. I use the rate limiter strategies to deal with that.
However, on app start, Polly doesn't know of the existing limits for the day.
Example problem:
Suppose I'm allowed 100 per day, and use 80. The app is then restarted for some reason. At that point, polly would allow up to 100 requests (instead of 20) before throttling my code. Some APIs would just throttle those requests, but less-forgiving ones could pause/suspend an account, or automatically trigger a more expensive pricing tier.
Solution:
On app start, I can retrieve the current limits from the API. Is it possible to "seed" Polly with those values?
Beta Was this translation helpful? Give feedback.
All reactions