Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support weights for request rate limiting #713

Open
nirvana-msu opened this issue Nov 26, 2022 · 1 comment
Open

Support weights for request rate limiting #713

nirvana-msu opened this issue Nov 26, 2022 · 1 comment

Comments

@nirvana-msu
Copy link

nirvana-msu commented Nov 26, 2022

It would be very handy if RateLimit middleware (or a similar one) allowed to specify request weights. Some APIs assign different weights to different requests, and track the total weight used over a period of time (e.g. Binance API). So overall limit could be defined as weight per period of time (no different from current definition, other than the num units being weights instead of requests), and a weight would then need to be provided when making a request.

@nirvana-msu
Copy link
Author

One thing that is not obvious to me implementaion-wise, is how can poll_ready tell whether it has enough capacity to process a request if it doesn't yet know the request weight (there's no way to pass that through to poll_ready)? This wasn't an issue in RateLimit because all requests had same weight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant