tower-rs / tower

async fn(Request) -> Result<Response, Error>
https://docs.rs/tower
MIT License
3.56k stars 281 forks source link

[Feature Request]: Middleware for client side which implements balancing the RPS #773

Open Velnbur opened 4 months ago

Velnbur commented 4 months ago

Problem


I'm looking for a RateLimiter that dynamically changes its limits depending on the number of failed requests per second, as for most clients there is no way to know that before the execution.

Solution

This layer could be implemented like RateLimiter with PID and dynamic target