Skip to content

Commit

Permalink
Allow DataGatherer.Run to return without stopping the other errgroup …
Browse files Browse the repository at this point in the history
…Go Routines (#605)

Signed-off-by: Richard Wall <richard.wall@venafi.com>
  • Loading branch information
wallrj authored Nov 7, 2024
1 parent 4ce96c0 commit 1778ed5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/agent/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,14 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {

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

Expand Down

0 comments on commit 1778ed5

Please sign in to comment.