mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 19:37:46 +08:00
commands/refs: drop goroutine
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
This commit is contained in:
parent
204a53247c
commit
bd5be7efc8
@ -168,21 +168,14 @@ Displays the hashes of all local objects.
|
||||
return err
|
||||
}
|
||||
|
||||
out := make(chan interface{})
|
||||
|
||||
go func() {
|
||||
defer close(out)
|
||||
|
||||
for k := range allKeys {
|
||||
select {
|
||||
case out <- &RefWrapper{Ref: k.String()}:
|
||||
case <-req.Context.Done():
|
||||
return
|
||||
}
|
||||
for k := range allKeys {
|
||||
err := res.Emit(&RefWrapper{Ref: k.String()})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return res.Emit(out)
|
||||
return nil
|
||||
},
|
||||
Encoders: cmds.EncoderMap{
|
||||
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *RefWrapper) error {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user