mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-04 00:24:59 +00:00
Workqueue: Add generic versions that are properly typed
This change adds a generic version of the various workqueue types while retaining compatibility for the existing exported symbols and constructors. The generic variants are prefixed with `Typed` and the existing ones are marked as deprecated to nudge people to transition without breaking them. Kubernetes-commit: 0c7370bb851c15825d30a516722139ccccca0cfc
This commit is contained in:
committed by
Kubernetes Publisher
parent
9433226579
commit
d67dddfe90
@@ -25,17 +25,17 @@ import (
|
||||
|
||||
func TestRateLimitingQueue(t *testing.T) {
|
||||
limiter := NewItemExponentialFailureRateLimiter(1*time.Millisecond, 1*time.Second)
|
||||
queue := NewRateLimitingQueue(limiter).(*rateLimitingType)
|
||||
queue := NewRateLimitingQueue(limiter).(*rateLimitingType[any])
|
||||
fakeClock := testingclock.NewFakeClock(time.Now())
|
||||
delayingQueue := &delayingType{
|
||||
Interface: New(),
|
||||
delayingQueue := &delayingType[any]{
|
||||
TypedInterface: New(),
|
||||
clock: fakeClock,
|
||||
heartbeat: fakeClock.NewTicker(maxWait),
|
||||
stopCh: make(chan struct{}),
|
||||
waitingForAddCh: make(chan *waitFor, 1000),
|
||||
metrics: newRetryMetrics("", nil),
|
||||
}
|
||||
queue.DelayingInterface = delayingQueue
|
||||
queue.TypedDelayingInterface = delayingQueue
|
||||
|
||||
queue.AddRateLimited("one")
|
||||
waitEntry := <-delayingQueue.waitingForAddCh
|
||||
|
Reference in New Issue
Block a user