diff --git a/compparallel.go b/compparallel.go index f84f6b5..bbfd770 100644 --- a/compparallel.go +++ b/compparallel.go @@ -232,22 +232,21 @@ func getValueOrErrorParallel[T any]( defer cancel() value, empty, err := f(ctx, r.Router) if err != nil { - if !errors.Is(err, routing.ErrNotFound) && - !r.IgnoreError { - log.Debug("getValueOrErrorParallel: error calling router function for router ", r.Router, - " with timeout ", r.Timeout, - " and ignore errors ", r.IgnoreError, - " with error ", err, - ) - select { - case <-ctx.Done(): - case errCh <- err: - } - } else { + if r.IgnoreError || errors.Is(err, routing.ErrNotFound) { log.Debug("getValueOrErrorParallel: not found or ignorable error for router ", r.Router, " with timeout ", r.Timeout, " and ignore errors ", r.IgnoreError, ) + return + } + log.Debug("getValueOrErrorParallel: error calling router function for router ", r.Router, + " with timeout ", r.Timeout, + " and ignore errors ", r.IgnoreError, + " with error ", err, + ) + select { + case <-ctx.Done(): + case errCh <- err: } return }