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

Commit eee76dd

Browse files
committed
Emit errors once at end
1 parent 6ec34f8 commit eee76dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hamt/hamt.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,10 @@ func (ds *Shard) EnumLinksAsync(ctx context.Context) (<-chan format.LinkResult,
434434
defer cancel()
435435
getLinks := makeAsyncTrieGetLinks(ds.dserv, linkResults)
436436
cset := cid.NewSet()
437-
dag.EnumerateChildrenAsync(ctx, getLinks, ds.nd.Cid(), cset.Visit)
437+
err := dag.EnumerateChildrenAsync(ctx, getLinks, ds.nd.Cid(), cset.Visit)
438+
if err != nil {
439+
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
440+
}
438441
}()
439442
return linkResults, nil
440443
}
@@ -447,12 +450,10 @@ func makeAsyncTrieGetLinks(dagService ipld.DAGService, linkResults chan<- format
447450
return func(ctx context.Context, currentCid cid.Cid) ([]*ipld.Link, error) {
448451
node, err := dagService.Get(ctx, currentCid)
449452
if err != nil {
450-
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
451453
return nil, err
452454
}
453455
directoryShard, err := NewHamtFromDag(dagService, node)
454456
if err != nil {
455-
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
456457
return nil, err
457458
}
458459

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

465466
if err != nil {
466-
emitResult(ctx, linkResults, format.LinkResult{Link: nil, Err: err})
467467
return nil, err
468468
}
469469
if lnkLinkType == shardLink {

0 commit comments

Comments
 (0)