unify worker num to workers

Kubernetes-commit: e6df935fd30c56a8ece0da6152c60fc725d942b7
This commit is contained in:
astraw99 2021-08-09 10:48:53 +08:00 committed by Kubernetes Publisher
parent 6e98cc2cc7
commit 0bf5b5ab8f

View File

@ -148,7 +148,7 @@ func NewController(
// as syncing informer caches and starting workers. It will block until stopCh
// is closed, at which point it will shutdown the workqueue and wait for
// workers to finish processing their current work items.
func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error {
func (c *Controller) Run(workers int, stopCh <-chan struct{}) error {
defer utilruntime.HandleCrash()
defer c.workqueue.ShutDown()
@ -163,7 +163,7 @@ func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error {
klog.Info("Starting workers")
// Launch two workers to process Foo resources
for i := 0; i < threadiness; i++ {
for i := 0; i < workers; i++ {
go wait.Until(c.runWorker, time.Second, stopCh)
}