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

[Feature request] Concurrency limiting #69

Open
KaKi87 opened this issue Nov 4, 2024 · 4 comments
Open

[Feature request] Concurrency limiting #69

KaKi87 opened this issue Nov 4, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@KaKi87
Copy link

KaKi87 commented Nov 4, 2024

Hi,

It would be nice to be able to limit the number of requests that a client can make not just in a time range, but concurrently.

For example, if a client has reached a maximum number of allowed simultaneous requests, then another one will be rejected with 429 until at least another one finishes, after which they can try again.

Thanks

@mholt mholt added the enhancement New feature or request label Nov 4, 2024
@mohammed90
Copy link
Contributor

mohammed90 commented Nov 4, 2024

I think this kind of feature is better implemented in a listener_wrapper rather than an HTTP handler.

@mholt
Copy link
Owner

mholt commented Nov 4, 2024

The benefit of it being an HTTP handler is it can respond with an HTTP 429.

The problem is that a listener wrapper still has to accept the connection to know the IP address, and all it can do is unkindly close the connection after that. (Unless I'm missing something. Quite possible. Running on like 4 hours of sleep today.)

@mohammed90
Copy link
Contributor

The benefit of it being an HTTP handler is it can respond with an HTTP 429.

Good point

@KaKi87
Copy link
Author

KaKi87 commented Nov 5, 2024

Would the alternative be letting the request time out ?

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

No branches or pull requests

3 participants