Skip to content

Commit

Permalink
commands/refs: drop goroutine
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Overbool <overbool.xu@gmail.com>
  • Loading branch information
overbool committed Oct 27, 2018
1 parent 0df07e3 commit a35828a
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions core/commands/refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a35828a

Please sign in to comment.