Create simple version of ratelimit package

Allows for more testing.
This commit is contained in:
Justin Santa Barbara
2016-10-30 14:35:54 -04:00
parent e7efadaab1
commit cebfc821a4
11 changed files with 383 additions and 7 deletions

View File

@@ -25,8 +25,8 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/util/clock:go_default_library",
"//pkg/util/ratelimit:go_default_library",
"//pkg/util/runtime:go_default_library",
"//vendor:github.com/juju/ratelimit",
],
)

View File

@@ -21,7 +21,7 @@ import (
"sync"
"time"
"github.com/juju/ratelimit"
"k8s.io/kubernetes/pkg/util/ratelimit"
)
type RateLimiter interface {
@@ -35,7 +35,7 @@ type RateLimiter interface {
}
// DefaultControllerRateLimiter is a no-arg constructor for a default rate limiter for a workqueue. It has
// both overall and per-item rate limitting. The overall is a token bucket and the per-item is exponential
// both overall and per-item rate limiting. The overall is a token bucket and the per-item is exponential
func DefaultControllerRateLimiter() RateLimiter {
return NewMaxOfRateLimiter(
NewItemExponentialFailureRateLimiter(5*time.Millisecond, 1000*time.Second),