mirror of
https://github.com/grafana/loki.git
synced 2026-03-13 09:33:58 +08:00
* uses new StreamRateLimiter * sets burst before limiter, uses requested ts * creates new non infinite rate limiters when configs change * time/rate testware * less indirection & protect rate limit access from race conditions * removes old comment * always recreate stream limiter after config change
18 lines
421 B
Go
18 lines
421 B
Go
package validation
|
|
|
|
import "golang.org/x/time/rate"
|
|
|
|
// RateLimit is a colocated limit & burst config. It largely exists to
|
|
// eliminate accidental misconfigurations due to race conditions when
|
|
// requesting the limit & burst config sequentially, between which the
|
|
// Limits configuration may have updated.
|
|
type RateLimit struct {
|
|
Limit rate.Limit
|
|
Burst int
|
|
}
|
|
|
|
var Unlimited = RateLimit{
|
|
Limit: rate.Inf,
|
|
Burst: 0,
|
|
}
|