Merge pull request #721 from sargun/fix-race-condition
Fix race condition around worker ID generation in podcontroller.go
This commit is contained in:
@@ -227,9 +227,10 @@ func (pc *PodController) Run(ctx context.Context, podSyncWorkers int) error {
|
|||||||
|
|
||||||
log.G(ctx).Info("starting workers")
|
log.G(ctx).Info("starting workers")
|
||||||
for id := 0; id < podSyncWorkers; id++ {
|
for id := 0; id < podSyncWorkers; id++ {
|
||||||
|
workerID := strconv.Itoa(id)
|
||||||
go wait.Until(func() {
|
go wait.Until(func() {
|
||||||
// Use the worker's "index" as its ID so we can use it for tracing.
|
// Use the worker's "index" as its ID so we can use it for tracing.
|
||||||
pc.runWorker(ctx, strconv.Itoa(id), pc.k8sQ)
|
pc.runWorker(ctx, workerID, pc.k8sQ)
|
||||||
}, time.Second, ctx.Done())
|
}, time.Second, ctx.Done())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user