-
Notifications
You must be signed in to change notification settings - Fork 299
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
A generic backend for request throttling #22
Comments
I think the best you might be able to do is attach a set of generic properties (very untyped in general) that provides hints to the backend if that backend supports it. But I think this would need to be per-request so that per-request "hints" would work. There may be an easy way to accommodate this somehow by using a more clever |
@aappddeevv the "hints" you mention are already there: each request carries a |
Oh...however, I don't see that on the async backend, which is pretty much all I use these days. |
@aappddeevv hm ... maybe I misunderstood you then, that's a field on the |
Yes. If its one thing I have learned, its crazy HTTP request wild-west world out there. You could also overload .send to be backend specific with a hints object so that at least when sending, you have statically typed "options" for sending. That ties you to a backend, but I think that this is Ok because when you need it, you need it. |
This can be implemented independently of sttp, in a more general way: we don't need to do anything HTTP-specific, but to rate-limit an |
Maybe it would be possible to create a generic backend wrapper (maybe generic for all backends, maybe only for asynchronous ones?) which would allow throttling of requests?
Throttling could be per-host or per-host+path.
Or maybe there is a throttling library which we could use?
The text was updated successfully, but these errors were encountered: