Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnavarro committed Sep 15, 2022
1 parent 0a92493 commit 1b62822
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
5 changes: 0 additions & 5 deletions compparallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ func getValueOrErrorParallel[T any](
defer tim.Stop()
select {
case <-ctx.Done():
if !r.IgnoreError {
errCh <- ctx.Err()
}
case <-tim.C:
ctx, cancel := context.WithTimeout(ctx, r.Timeout)
defer cancel()
Expand Down Expand Up @@ -314,13 +311,11 @@ func getChannelOrErrorParallel[T any](

select {
case err, ok := <-errCh:
cancelAll()
if !ok {
return nil, routing.ErrNotFound
}
return nil, err
case <-ctx.Done():
cancelAll()
return nil, ctx.Err()
default:
return outCh, nil
Expand Down
7 changes: 0 additions & 7 deletions compsequential.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package routinghelpers
import (
"context"
"errors"
"sync"
"sync/atomic"

"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -204,10 +203,7 @@ func getChannelOrErrorSequential[T any](
chans = append(chans, rch)
}

var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
for i := 0; i < len(chans); i++ {
if chans[i] == nil {
cancels[i]()
Expand All @@ -229,10 +225,7 @@ func getChannelOrErrorSequential[T any](

cancels[i]()
}
}()

go func() {
wg.Wait()
close(chanOut)
}()

Expand Down

0 comments on commit 1b62822

Please sign in to comment.