提交 ce0bf803 作者: W. Trevor King

core/commands/unixfs/ls: Replace TODO context with command context

Discussing this on IRC ([1] through [2]), Jeromy and I decided that
we'd really like a way to configure per-command [3] and per-action
timeouts, but until we have that we want to leave the minute limit
here.  We also decided that the use of TODO here instead of the
per-command req.Context().Context was a bug, which I'm fixing with
this commit.

[1]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41714126&page=4
[2]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41715618&page=4
[3]: https://github.com/ipfs/go-ipfs/issues/1325

License: MIT
Signed-off-by: 's avatarW. Trevor King <wking@tremily.us>
上级 f0a0ac1b
...@@ -94,7 +94,7 @@ directories, the child size is the IPFS link size. ...@@ -94,7 +94,7 @@ directories, the child size is the IPFS link size.
case unixfspb.Data_Directory: case unixfspb.Data_Directory:
output[i].Links = make([]LsLink, len(merkleNode.Links)) output[i].Links = make([]LsLink, len(merkleNode.Links))
for j, link := range merkleNode.Links { for j, link := range merkleNode.Links {
getCtx, cancel := context.WithTimeout(context.TODO(), time.Minute) getCtx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel() defer cancel()
link.Node, err = link.GetNode(getCtx, node.DAG) link.Node, err = link.GetNode(getCtx, node.DAG)
if err != nil { if err != nil {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论