1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-20 19:19:06 +08:00

fix(commands): fix filestore.go goroutine leak

License: MIT
Signed-off-by: Overbool <overbool.xu@gmail.com>
This commit is contained in:
Overbool
2018-09-07 23:12:50 +08:00
parent 573bada803
commit 725eefaeb0

View File

@ -218,11 +218,18 @@ var dupsFileStore = &oldCmds.Command{
for cid := range ch {
have, err := fs.MainBlockstore().Has(cid)
if err != nil {
out <- &RefWrapper{Err: err.Error()}
select {
case out <- &RefWrapper{Err: err.Error()}:
case <-req.Context().Done():
}
return
}
if have {
out <- &RefWrapper{Ref: cid.String()}
select {
case out <- &RefWrapper{Ref: cid.String()}:
case <-req.Context().Done():
return
}
}
}
}()