You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I've been trying out your nice library for a personal project with success.
My use case is to rate limit some tasks which request an upstream API.
I have some tasks which perform multiple API requests.
I'd love to make the TokenBucket aware of it.
# If my task has `factor` set to 2 it means it consumes to tokens from the bucket.@rate_limit(token_bucket_name="my_bucket", factor=2)
The text was updated successfully, but these errors were encountered:
So let's assume we would iterate and consume as many tokens as requested. Running multiple workers in parallel could lead to the situation that when your bucket is getting close to be empty, the concurrent workers would start consuming from the queue without ever reaching their desired count and all would fail.
If there would be a way to consume multiple items in an atomic transaction, we could go ahead and implement this.
However, I am not aware of one.
Hey, I've been trying out your nice library for a personal project with success.
My use case is to rate limit some tasks which request an upstream API.
I have some tasks which perform multiple API requests.
I'd love to make the
TokenBucket
aware of it.The text was updated successfully, but these errors were encountered: