Skip to content

Commit 1f1fbf4

Browse files
committed
must-gather: Call queue.Done at the right time
Currently defer queue.Done(pod) is called in a worker thread loop, which means that the pod is marked as done when the whole worker thread exits and not in that pod processing loop iteration. This is now fixed and the pod is marked as processed as soon as it is actually processed.
1 parent 7a94ed9 commit 1f1fbf4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/cli/admin/mustgather/mustgather.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,14 @@ func (o *MustGatherOptions) Run() error {
695695
if quit {
696696
return
697697
}
698-
defer queue.Done(pod)
699-
if err := o.processNextWorkItem(ns.Name, pod.(*corev1.Pod)); err != nil {
700-
errCh <- err
701-
}
698+
func() {
699+
// Make sure queue.Done is called inside the current iteration,
700+
// not just when the whole worker thread exits.
701+
defer queue.Done(pod)
702+
if err := o.processNextWorkItem(ctx, ns.Name, pod); err != nil {
703+
errCh <- err
704+
}
705+
}()
702706
}
703707
}()
704708
}

0 commit comments

Comments
 (0)