Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci-kal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ linters:
#- "jsontags" # Ensure every field has a json tag.
#- "maxlength" # Ensure all strings and arrays have maximum lengths/maximum items.
#- "nobools" # Bools do not evolve over time, should use enums instead.
#- "nofloats" # Ensure floats are not used.
- "nofloats" # Ensure floats are not used.
#- "optionalorrequired" # Every field should be marked as `+optional` or `+required`.
# - "requiredfields" # Required fields should not be pointers, and should not have `omitempty`.
- "statussubresource" # All root objects that have a `status` field should have a status subresource.
Expand Down
6 changes: 6 additions & 0 deletions pkg/internal/rate/rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
// Limit defines the maximum frequency of some events.
// Limit is represented as number of events per second.
// A zero Limit allows no events.
//
//nolint:kubeapilinter // This is an internal rate limiter implementation, not a Kubernetes API
type Limit float64

// Inf is the infinite rate limit; it allows all events (even if burst is zero).
Expand Down Expand Up @@ -66,6 +68,8 @@ func Every(interval time.Duration) Limit {
// or its associated context.Context is canceled.
//
// The methods AllowN, ReserveN, and WaitN consume n tokens.
//
//nolint:kubeapilinter // This is an internal rate limiter implementation, not a Kubernetes API
type Limiter struct {
mu sync.Mutex
limit Limit
Expand Down Expand Up @@ -117,6 +121,8 @@ func (lim *Limiter) AllowN(now time.Time, n int) bool {

// A Reservation holds information about events that are permitted by a Limiter to happen after a delay.
// A Reservation may be canceled, which may enable the Limiter to permit additional events.
//
//nolint:kubeapilinter // This is an internal rate limiter implementation, not a Kubernetes API
type Reservation struct {
ok bool
lim *Limiter
Expand Down