-
Notifications
You must be signed in to change notification settings - Fork 519
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
feat(layer): add throttle layer #2444
Conversation
6dbe3e9
to
a917016
Compare
a917016
to
9a7bf48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, only some naming related issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
BTW, there are still 2 todo item comments inside this PR:
If you believe that they are not essential, then I will remove them. |
We can get the read size and wait for them. But it may be complex for waiting in
Current behavior LGTM. |
Description
Background
As there's no open-source repository that uses Governor to limit bandwidth so far IMK, it's mostly used to limit the number of requests, e.g. tower-governor (although Governor can theoretically limit any element).
There's an issue asked by Quickwit's author about how to use Governor to limit IO throughput, but he ended up using async-speed-limit for Quickwit (PR, which also seems to use a truncated byte stream implementation.).
My current implementation uses the answer provided in the above issue by the Governor author. However, it's rough and untested, and there are some uncertainties that I left comments inline. Things I need more information to confirm include:
inner.read()
implementor's behavior?(I assume)?