From 7a9c7b4dd35124a5e8ef092184af3e78ccadebfc Mon Sep 17 00:00:00 2001 From: Kejie Zhang <601172892@qq.com> Date: Wed, 5 Sep 2018 20:57:14 +0800 Subject: [PATCH] fix goroutine leaks in filestore.go License: MIT Signed-off-by: Kejie Zhang <601172892@qq.com> --- core/commands/filestore.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/commands/filestore.go b/core/commands/filestore.go index 4eded09c9e6..9d78a8df1ff 100644 --- a/core/commands/filestore.go +++ b/core/commands/filestore.go @@ -269,10 +269,14 @@ func perKeyActionToChan(ctx context.Context, args []string, action func(*cid.Cid for _, arg := range args { c, err := cid.Decode(arg) if err != nil { - out <- &filestore.ListRes{ + select { + case out <- &filestore.ListRes{ Status: filestore.StatusOtherError, ErrorMsg: fmt.Sprintf("%s: %v", arg, err), + }: + case <-ctx.Done(): } + continue } r := action(c)