Files
loki/pkg/validation/rate.go
Owen Diehl 668622c813 Refactor per stream rate limit (#4213)
* 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
2021-08-25 14:46:54 -04:00

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,
}