mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-04 08:35:10 +00:00
Refactor client-go/util/flowcontrol/throttle.go RateLimiter
- Introduce PassiveRateLimiter which implements all methods of previous RateLimiter except Accept() and Wait() - Change RateLimiter interface to extend PassiveRateLimiter by additionally implementing Accept() and Wait() - Make client-go/tools/record use PassiveRateLimiter Refactor EventSourceObjectSpamFilter, EventAggregator, EventCorrelator - EventSourceObjectSpamFilter, EventAggregator, EventCorrelator use clock.PassiveClock now. - This won't be a breaking change because even if a clock.Clock is passed, it still implements the clock.PassiveClock interface. - Extend clock.PassiveClock through Clock. - Replace pacakge local implementation of realClock with clock.RealClock - In flowcontrol/throttle.go split tokenBucketRateLimiters to use Clock and clock.PassiveClock. - Migrate client-go/tools/record tests from using IntervalClock to using SimpleIntervalClock (honest implementation of clock.PassiveClock) Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com> Kubernetes-commit: ac5c55f0bd853fcf883d9b8e1f5ef728a2fb5309
This commit is contained in:
committed by
Kubernetes Publisher
parent
191e5dc23b
commit
b9fa896d5d
@@ -81,7 +81,7 @@ type CorrelatorOptions struct {
|
||||
MaxIntervalInSeconds int
|
||||
// The clock used by the EventAggregator to allow for testing
|
||||
// If not specified (zero value), clock.RealClock{} will be used
|
||||
Clock clock.Clock
|
||||
Clock clock.PassiveClock
|
||||
// The func used by EventFilterFunc, which returns a key for given event, based on which filtering will take place
|
||||
// If not specified (zero value), getSpamKey will be used
|
||||
SpamKeyFunc EventSpamKeyFunc
|
||||
@@ -323,7 +323,7 @@ type recorderImpl struct {
|
||||
scheme *runtime.Scheme
|
||||
source v1.EventSource
|
||||
*watch.Broadcaster
|
||||
clock clock.Clock
|
||||
clock clock.PassiveClock
|
||||
}
|
||||
|
||||
func (recorder *recorderImpl) generateEvent(object runtime.Object, annotations map[string]string, eventtype, reason, message string) {
|
||||
|
Reference in New Issue
Block a user