Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Emit errors once at end
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward committed Oct 18, 2018
1 parent 6ec34f8 commit eee76dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hamt/hamt.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,10 @@ func (ds *Shard) EnumLinksAsync(ctx context.Context) (<-chan format.LinkResult,
defer cancel()
getLinks := makeAsyncTrieGetLinks(ds.dserv, linkResults)
cset := cid.NewSet()
dag.EnumerateChildrenAsync(ctx, getLinks, ds.nd.Cid(), cset.Visit)
err := dag.EnumerateChildrenAsync(ctx, getLinks, ds.nd.Cid(), cset.Visit)
if err != nil {
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
}
}()
return linkResults, nil
}
Expand All @@ -447,12 +450,10 @@ func makeAsyncTrieGetLinks(dagService ipld.DAGService, linkResults chan<- format
return func(ctx context.Context, currentCid cid.Cid) ([]*ipld.Link, error) {
node, err := dagService.Get(ctx, currentCid)
if err != nil {
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
return nil, err
}
directoryShard, err := NewHamtFromDag(dagService, node)
if err != nil {
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
return nil, err
}

Expand All @@ -463,7 +464,6 @@ func makeAsyncTrieGetLinks(dagService ipld.DAGService, linkResults chan<- format
lnkLinkType, err := directoryShard.childLinkType(lnk)

if err != nil {
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
return nil, err
}
if lnkLinkType == shardLink {
Expand Down

0 comments on commit eee76dd

Please sign in to comment.