fix goroutine leaks in filestore.go

License: MIT
Signed-off-by: Kejie Zhang <601172892@qq.com>
This commit is contained in:
Kejie Zhang 2018-09-05 20:57:14 +08:00
parent 78a32f2e48
commit 7a9c7b4dd3

View File

@ -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)