Open nicholasd-ff opened 5 months ago
Agree, I will work on it soon
I'm happy to contribute a PR and tests if you can explain how you think it should work, the options that make sense to me are:
But I admit I haven't thought through all the corner cases this behaviour might produce.
Sound good to me. Testing the delay & wait should be easy using in-memory-bucket i think
Hi, thanks for all your work on pyrate limiter. I've been testing my code after upgrading from the 2 series to 3.4.1 and have run into some issues with max delay.
In the previous major version of the library it was easy to create a requester that just blocked until it was safe to make a new request, now it seems like max_delay must be set in order to block and setting max_delay requires a formula based on the maximum wait period and knowledge of the internals of the engine. (specifically that 50ms is added to the max_delay so you can't just set it to 1000ms if you want 1 request a second.
For example:
Produces the following output:
With a set of rates (e..g 1 request /second 500/hour) it becomes quite complicated to calculate max_delay such that the API actually blocks, otherwise it's just immediately going to return false and you have to implement your own loop to retry.