ulule / limiter

Dead simple rate limit middleware for Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Which time windows does this limiter use?

Joldnine opened this issue · comments

Is it sliding window or fixed window? How can it be configured for the window?

Hello,

It's a fixed window. You can configure it by using this way:

rate := limiter.Rate{
    Period: 1 * time.Minute,
    Limit:  100,
}

Or even this way:

rate, err := limiter.NewRateFromFormatted("100-M")

You'll have a window of one minute that allows 100 requests.

If you have further question, don't hesitate 🙂