unify worker num to workers

This commit is contained in:
astraw99
2021-08-09 10:48:53 +08:00
parent fc26906546
commit e6df935fd3
10 changed files with 21 additions and 21 deletions

View File

@@ -432,7 +432,7 @@ func (c *Controller) Enqueue() {
}
// Run the controller until stopped.
func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) {
func (c *Controller) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
// make sure the work queue is shutdown which will trigger workers to end
defer c.queue.ShutDown()

View File

@@ -32,7 +32,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
"k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
v1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
)
// AutoAPIServiceRegistration is an interface which callers can re-declare locally and properly cast to for
@@ -103,7 +103,7 @@ func NewCRDRegistrationController(crdinformer crdinformers.CustomResourceDefinit
return c
}
func (c *crdRegistrationController) Run(threadiness int, stopCh <-chan struct{}) {
func (c *crdRegistrationController) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
// make sure the work queue is shutdown which will trigger workers to end
defer c.queue.ShutDown()
@@ -130,8 +130,8 @@ func (c *crdRegistrationController) Run(threadiness int, stopCh <-chan struct{})
}
close(c.syncedInitialSet)
// start up your worker threads based on threadiness. Some controllers have multiple kinds of workers
for i := 0; i < threadiness; i++ {
// start up your worker threads based on workers. Some controllers have multiple kinds of workers
for i := 0; i < workers; i++ {
// runWorker will loop until "something bad" happens. The .Until will then rekick the worker
// after one second
go wait.Until(c.runWorker, time.Second, stopCh)