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:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
Reference in New Issue
Block a user