client-go workqueue: add optional logger

NewTypedDelayingQueueWithConfig spawns a goroutine, but apparently shutdown is
already handled somehow. Therefore only the option to set a logger gets added
to the Config struct.

The problem then becomes that developers might forget to set that
logger. logcheck can't detect that. For now, all in-tree users get updated
immediately.

Kubernetes-commit: f20eb2e7c16a9b28e69fd0bba2000e7166d68f29
This commit is contained in:
Patrick Ohly
2024-12-11 12:45:57 +01:00
committed by Kubernetes Publisher
parent 7faeb317c7
commit a96aa53864
2 changed files with 15 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ func ParallelizeUntil(ctx context.Context, workers, pieces int, doWorkPiece DoWo
wg.Add(workers)
for i := 0; i < workers; i++ {
go func() {
defer utilruntime.HandleCrash()
defer utilruntime.HandleCrashWithContext(ctx)
defer wg.Done()
for chunk := range toProcess {
start := chunk * chunkSize