Unverified Commit 53eb8d06 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #21 from ipfs/fix/fetch-deadlock

fix a fetch deadlock on error
parents ff7c0709 3b8c0ad4
......@@ -397,7 +397,10 @@ func EnumerateChildrenAsyncDepth(ctx context.Context, getLinks GetLinks, c cid.C
if shouldVisit {
links, err := getLinks(ctx, ci)
if err != nil {
errChan <- err
select {
case errChan <- err:
case <-fetchersCtx.Done():
}
return
}
......
......@@ -677,6 +677,7 @@ func TestEnumerateAsyncFailsNotFound(t *testing.T) {
b := NodeWithData([]byte("foo2"))
c := NodeWithData([]byte("foo3"))
d := NodeWithData([]byte("foo4"))
e := NodeWithData([]byte("foo5"))
ds := dstest.Mock()
for _, n := range []ipld.Node{a, b, c} {
......@@ -703,6 +704,10 @@ func TestEnumerateAsyncFailsNotFound(t *testing.T) {
t.Fatal(err)
}
if err := parent.AddNodeLink("e", e); err != nil {
t.Fatal(err)
}
err := ds.Add(ctx, parent)
if err != nil {
t.Fatal(err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment