Skip to content

Commit 573bada

Browse files
authored
Merge pull request ipfs#5427 from kjzz/fix-goroutine
fix goroutine leaks in filestore.go
2 parents bdbb63d + 7a9c7b4 commit 573bada

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/commands/filestore.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,14 @@ func perKeyActionToChan(ctx context.Context, args []string, action func(*cid.Cid
269269
for _, arg := range args {
270270
c, err := cid.Decode(arg)
271271
if err != nil {
272-
out <- &filestore.ListRes{
272+
select {
273+
case out <- &filestore.ListRes{
273274
Status: filestore.StatusOtherError,
274275
ErrorMsg: fmt.Sprintf("%s: %v", arg, err),
276+
}:
277+
case <-ctx.Done():
275278
}
279+
276280
continue
277281
}
278282
r := action(c)

0 commit comments

Comments
 (0)