Skip to content

Commit

Permalink
Address missed TODO ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Jun 4, 2021
1 parent 971379c commit efeaea7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions markets/utils/selectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,18 @@ func TraverseDag(

// this is how we implement GETs
linkSystem := cidlink.DefaultLinkSystem()
linkSystem.StorageReadOpener = func(_ ipld.LinkContext, lnk ipld.Link) (io.Reader, error) {
if cl, isCid := lnk.(cidlink.Link); !isCid {
linkSystem.StorageReadOpener = func(lctx ipld.LinkContext, lnk ipld.Link) (io.Reader, error) {
cl, isCid := lnk.(cidlink.Link)
if !isCid {
return nil, fmt.Errorf("unexpected link type %#v", lnk)
} else {
node, err := ds.Get(context.TODO(), cl.Cid)
if err != nil {
return nil, err
}
return bytes.NewBuffer(node.RawData()), nil
}

node, err := ds.Get(lctx.Ctx, cl.Cid)
if err != nil {
return nil, err
}

return bytes.NewBuffer(node.RawData()), nil
}

// this is how we pull the start node out of the DS
Expand Down

0 comments on commit efeaea7

Please sign in to comment.