Skip to content

Commit

Permalink
Remove error.Join due to compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusFranco99 committed Jul 16, 2024
1 parent b665ab3 commit 2a5e1a2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions network/topics/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,28 @@ func (ctrl *topicsCtrl) UpdateScoreParams(logger *zap.Logger) error {
if ctrl.scoreParamsFactory == nil {
return fmt.Errorf("scoreParamsFactory is not set")
}
var errs error
errs := ""
topics := ctrl.ps.GetTopics()
for _, topicName := range topics {
topic := ctrl.container.Get(topicName)
if topic == nil {
errs = errors.Join(errs, fmt.Errorf("topic %s is not ready", topicName))
errs = errs + fmt.Sprintf("topic %s is not ready; ", topicName)
continue
}
p := ctrl.scoreParamsFactory(topicName)
if p == nil {
errs = errors.Join(errs, fmt.Errorf("score params for topic %s is nil", topicName))
errs = errs + fmt.Sprintf("score params for topic %s is nil; ", topicName)
continue
}
if err := topic.SetScoreParams(p); err != nil {
errs = errors.Join(errs, fmt.Errorf("could not set score params for topic %s: %w", topicName, err))
errs = errs + fmt.Sprintf("could not set score params for topic %s: %w; ", topicName, err)
continue
}
}
return errs
if len(errs) > 0 {
return fmt.Errorf(errs)
}
return nil
}

// Close implements io.Closer
Expand Down

0 comments on commit 2a5e1a2

Please sign in to comment.