mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-05-19 00:00:14 +08:00
unify worker num to workers
Kubernetes-commit: e6df935fd30c56a8ece0da6152c60fc725d942b7
This commit is contained in:
committed by
Kubernetes Publisher
parent
6e98cc2cc7
commit
0bf5b5ab8f
+2
-2
@@ -148,7 +148,7 @@ func NewController(
|
|||||||
// as syncing informer caches and starting workers. It will block until stopCh
|
// 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
|
// is closed, at which point it will shutdown the workqueue and wait for
|
||||||
// workers to finish processing their current work items.
|
// 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 utilruntime.HandleCrash()
|
||||||
defer c.workqueue.ShutDown()
|
defer c.workqueue.ShutDown()
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error {
|
|||||||
|
|
||||||
klog.Info("Starting workers")
|
klog.Info("Starting workers")
|
||||||
// Launch two workers to process Foo resources
|
// 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)
|
go wait.Until(c.runWorker, time.Second, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user