Skip to content

Commit

Permalink
fix pod client creation; move streamLogs onto reconciler thread
Browse files Browse the repository at this point in the history
rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
gabemontero committed Feb 21, 2024
1 parent 83dfded commit f9f94f4
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions pkg/watcher/reconciler/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,22 +337,21 @@ func (r *Reconciler) sendLog(ctx context.Context, o results.Object) error {
zap.String("name", o.GetName()),
)

go func() {
err := r.streamLogs(ctx, o, labelKey, logName)
if err != nil {
logger.Errorw("Error streaming log",
zap.String("namespace", o.GetNamespace()),
zap.String("kind", o.GetObjectKind().GroupVersionKind().Kind),
zap.String("name", o.GetName()),
zap.Error(err),
)
}
logger.Debugw("Streaming log completed",
err = r.streamLogs(ctx, o, labelKey, logName)
if err != nil {
logger.Errorw("Error streaming log",
zap.String("namespace", o.GetNamespace()),
zap.String("kind", o.GetObjectKind().GroupVersionKind().Kind),
zap.String("name", o.GetName()),
zap.Error(err),
)
}()
return err
}
logger.Debugw("Streaming log completed",
zap.String("namespace", o.GetNamespace()),
zap.String("kind", o.GetObjectKind().GroupVersionKind().Kind),
zap.String("name", o.GetName()),
)
}

return nil
Expand Down

0 comments on commit f9f94f4

Please sign in to comment.