Skip to content

Adjusting rate limiter's quota #273

Open
@michaelinoue

Description

@michaelinoue

Hello, I was wondering what the best way would be to change a rate limiter's quota. Following this thread from a few years ago, it seemed like there was some interest in allowing for rate limiters to change their parameters, but that there were some difficulties due to potential overhead for making this thread-safe.

I believe then, that the best way to adjust a rate limiter's quota is effectively to make a new one. If I consume a rate limiter with RateLimiter::into_state_store() and construct a new one with RateLimiter::new() with a new quota and the previous state, would the new rate limiter accurately keep track of the previous requests within the relevant window? Would this still work depending on if the quota increased or decreased?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions