Skip to content

Commit 1778ed5

Browse files
authored
Allow DataGatherer.Run to return without stopping the other errgroup Go Routines (#605)
Signed-off-by: Richard Wall <[email protected]>
1 parent 4ce96c0 commit 1778ed5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/agent/run.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,14 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {
183183

184184
// start the data gatherers and wait for the cache sync
185185
group.Go(func() error {
186+
// Most implementations of `DataGatherer.Run` return immediately.
187+
// Only the Dynamic DataGatherer starts an informer which runs and
188+
// blocks until the supplied channel is closed.
189+
// For this reason, we must allow these errgroup Go routines to exit
190+
// without cancelling the other Go routines in the group.
186191
if err := newDg.Run(gctx.Done()); err != nil {
187192
return fmt.Errorf("failed to start %q data gatherer %q: %v", kind, dgConfig.Name, err)
188193
}
189-
// The agent must stop if any of the data gatherers stops
190-
cancel()
191194
return nil
192195
})
193196

0 commit comments

Comments
 (0)