Use the generic/typed workqueue throughout
This change makes us use the generic workqueue throughout the project in order to improve type safety and readability of the code.
This commit is contained in:
@@ -123,7 +123,7 @@ type DaemonSetsController struct {
|
||||
nodeStoreSynced cache.InformerSynced
|
||||
|
||||
// DaemonSet keys that need to be synced.
|
||||
queue workqueue.RateLimitingInterface
|
||||
queue workqueue.TypedRateLimitingInterface[string]
|
||||
|
||||
failedPodsBackoff *flowcontrol.Backoff
|
||||
}
|
||||
@@ -153,7 +153,12 @@ func NewDaemonSetsController(
|
||||
},
|
||||
burstReplicas: BurstReplicas,
|
||||
expectations: controller.NewControllerExpectations(),
|
||||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "daemonset"),
|
||||
queue: workqueue.NewTypedRateLimitingQueueWithConfig(
|
||||
workqueue.DefaultTypedControllerRateLimiter[string](),
|
||||
workqueue.TypedRateLimitingQueueConfig[string]{
|
||||
Name: "daemonset",
|
||||
},
|
||||
),
|
||||
}
|
||||
|
||||
daemonSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
@@ -315,7 +320,7 @@ func (dsc *DaemonSetsController) processNextWorkItem(ctx context.Context) bool {
|
||||
}
|
||||
defer dsc.queue.Done(dsKey)
|
||||
|
||||
err := dsc.syncHandler(ctx, dsKey.(string))
|
||||
err := dsc.syncHandler(ctx, dsKey)
|
||||
if err == nil {
|
||||
dsc.queue.Forget(dsKey)
|
||||
return true
|
||||
|
Reference in New Issue
Block a user