Open tdesai2017 opened 2 months ago
Currently there is no method to manually leak a certain weight. Either you flush it completely or leave it be.
There is a method called (async) def waiting() -> int
in the bucket interface. If it returns 0 then the bucket is able to acquire item. You can loop check the buckets to see if all of them are available for acquiring data.
Regarding the manual leak, I'll see what I can do when I have some spare time.
Awesome, thank you!
Hello!
A usecase I've been hoping to use PyrateLimiter for requires that I be able to
My specific use case is as follows. Let's say I have 3 buckets. I only want to make a request if all 3 buckets have capacity. If all 3 do, I want to fill each bucket with a weight of one, but if at least 1 of the 3 buckets does not have capacity, I do not want to fill any of them. The reason is because I have to actively rate-limit over 3 different variables in order to make my request, so I only want to make my request when the buckets that represent each of these 3 variables each have >0 capacity.
The easiest way I can see to implement this is with a while true loop, something like
Aside/Additional context In my use-case, other requests may require that some N other buckets have capacity. Ultimately, I may have 100 buckets, and
Some of the 5 buckets for request-1 may or may not coincide with some of the 3 buckets for request-2)
As far as I can tell, PyrateLimiter does not support these two functionalities yet - so I was wondering I was by chance mistaken, or if these functionalities may be coming soon
Thank you!