From 01232eff8d98e252d52178bda00e5dce62822da2 Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Mon, 23 Oct 2023 23:09:44 -0400 Subject: [PATCH] another worker pool refactor --- pkg/sync/loop.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/sync/loop.go b/pkg/sync/loop.go index fb5f0dab..f22ebeb9 100644 --- a/pkg/sync/loop.go +++ b/pkg/sync/loop.go @@ -6,7 +6,6 @@ import ( "runtime/debug" "time" - "github.com/alitto/pond" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/wait" @@ -32,19 +31,18 @@ func (engine *Engine) ControlLoop() { } engine.RegisterHandlers() - - pool := pond.New(20, 0, pond.MinWorkers(20)) for i := 0; i < 20; i++ { - pool.TrySubmit(engine.workerLoop) + go engine.workerLoop() } - pool.StopAndWait() } func (engine *Engine) workerLoop() { + log.Info("starting sync worker") wait.PollInfinite(syncDelay, func() (done bool, err error) { log.Info("polling for new service updates") item, shutdown := engine.svcQueue.Get() if shutdown { + log.Info("shutting down worker") return true, nil } err = engine.processItem(item)