Skip to content

Commit 2b87a1b

Browse files
authored
Merge pull request #5439 from overbool/fix/goroutine-leaks
fix(commands): fix filestore.go goroutine leak
2 parents 573bada + 725eefa commit 2b87a1b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/commands/filestore.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,18 @@ var dupsFileStore = &oldCmds.Command{
218218
for cid := range ch {
219219
have, err := fs.MainBlockstore().Has(cid)
220220
if err != nil {
221-
out <- &RefWrapper{Err: err.Error()}
221+
select {
222+
case out <- &RefWrapper{Err: err.Error()}:
223+
case <-req.Context().Done():
224+
}
222225
return
223226
}
224227
if have {
225-
out <- &RefWrapper{Ref: cid.String()}
228+
select {
229+
case out <- &RefWrapper{Ref: cid.String()}:
230+
case <-req.Context().Done():
231+
return
232+
}
226233
}
227234
}
228235
}()

0 commit comments

Comments
 (0)