Skip to content

Commit

Permalink
Expose the default rate limiter
Browse files Browse the repository at this point in the history
The default configurations for rate limiter is exposed only to flag set.
This change adds a new function GetDefaultRateLimiter() to provide
access to the same rate limiter configuration without flags. This is
useful for setting the default rate limiter for reconcilers in test
suites.

Signed-off-by: Sunny <[email protected]>
  • Loading branch information
darkowlzz committed Jan 4, 2023
1 parent 90080a7 commit 7c91736
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions runtime/controller/rate_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ func GetRateLimiter(opts RateLimiterOptions) ratelimiter.RateLimiter {
opts.MinRetryDelay,
opts.MaxRetryDelay)
}

// GetDefaultRateLimiter returns a new exponential failure
// ratelimiter.RateLimiter with the default configuration.
func GetDefaultRateLimiter() ratelimiter.RateLimiter {
return workqueue.NewItemExponentialFailureRateLimiter(
defaultMinRetryDelay,
defaultMaxRetryDelay)
}

0 comments on commit 7c91736

Please sign in to comment.