Fix goroutine leak in dag put
License: MIT Signed-off-by: Alec Brickner <alecjbrick@gmail.com>
Alec Brickner committed
May 12, 2018 at 03:35 UTC
4a59b557e7dd2034fa44a406ee3a8fc51638a32a
1 file changed
+6
-1
core/commands/dag/dag.go
+6
-1
@@ -128,7 +128,12 @@ into an object of the specified format.
128
129
cid := nds[0].Cid()
130
cids.Add(cid)
131
- outChan <- &OutputObject{Cid: cid}
131
+
132
+ select {
133
+ case outChan <- &OutputObject{Cid: cid}:
134
+ case <-req.Context().Done():
135
+ return nil
136
+ }
137
}
138
139
if err := b.Commit(); err != nil {