提交 cba00b90 作者: Jeromy

fixes from review

License: MIT
Signed-off-by: 's avatarJeromy <jeromyj@gmail.com>
上级 d2931d70
......@@ -33,7 +33,7 @@ type PinOutput struct {
var addPinCmd = &cmds.Command{
Helptext: cmds.HelpText{
Tagline: "Pins objects to local storage.",
Tagline: "Pins objects to local storage.",
ShortDescription: "Stores an IPFS object(s) from a given path locally to disk.",
},
......
......@@ -146,14 +146,13 @@ func FindLinks(links []key.Key, k key.Key, start int) []int {
}
func (ds *dagService) GetMany(ctx context.Context, keys []key.Key) (<-chan *Node, <-chan error) {
out := make(chan *Node)
out := make(chan *Node, len(keys))
errs := make(chan error, 1)
blocks := ds.Blocks.GetBlocks(ctx, keys)
var count int
go func() {
defer close(out)
defer close(errs)
for {
select {
case b, ok := <-blocks:
......@@ -168,13 +167,13 @@ func (ds *dagService) GetMany(ctx context.Context, keys []key.Key) (<-chan *Node
errs <- err
return
}
select {
case out <- nd:
count++
case <-ctx.Done():
return
}
// buffered, no need to select
out <- nd
count++
case <-ctx.Done():
errs <- ctx.Err()
return
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论