Skip to content

Commit

Permalink
add comment, check error
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus committed Jan 14, 2025
1 parent e41cc9b commit e186b96
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/argo_client/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ func (a *ArgoClient) generateManifests(ctx context.Context, app v1alpha1.Applica
RefSources: refSources,
}

// creating a new client forces grpc to create a new connection, which causes
//the k8s load balancer to select a new pod, balancing requests among all repo-server pods.
repoClient, conn, err := a.createRepoServerClient()
if err != nil {
return nil, errors.Wrap(err, "error creating repo client")
Expand All @@ -237,7 +239,12 @@ func (a *ArgoClient) generateManifests(ctx context.Context, app v1alpha1.Applica
if err != nil {
return nil, errors.Wrap(err, "failed to get manifests with files")
}
defer stream.CloseSend()
defer func() {
err := stream.CloseSend()
if err != nil {
log.Error().Err(err).Msg("failed to close stream")
}
}()

log.Info().Msg("sending request")
if err := stream.Send(&repoapiclient.ManifestRequestWithFiles{
Expand Down

0 comments on commit e186b96

Please sign in to comment.