Replace deprecated queue method (#11859)

Co-authored-by: Ricardo Katz <ricardo.katz@gmail.com>
This commit is contained in:
k8s-infra-cherrypick-robot 2024-08-24 06:30:27 -07:00 committed by GitHub
parent ee0ccdcdf1
commit 8be1c5224a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,7 +36,7 @@ var keyFunc = cache.DeletionHandlingMetaNamespaceKeyFunc
// which timestamp is older than the last successful get operation.
type Queue struct {
// queue is the work queue the worker polls
queue workqueue.RateLimitingInterface
queue workqueue.TypedRateLimitingInterface[any]
// sync is called for each item in the queue
sync func(interface{}) error
// workerDone is closed when the worker exits
@ -172,7 +172,7 @@ func NewTaskQueue(syncFn func(interface{}) error) *Queue {
// NewCustomTaskQueue creates a new custom task queue with the given sync function.
func NewCustomTaskQueue(syncFn func(interface{}) error, fn func(interface{}) (interface{}, error)) *Queue {
q := &Queue{
queue: workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()),
queue: workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[any]()),
sync: syncFn,
workerDone: make(chan bool),
fn: fn,