event, p2p/simulations/adapters: use buffered channel to avoid goroutine leak

This commit is contained in:
BurtonQin 2020-02-12 18:42:43 +08:00
parent 34bb132b10
commit da12747636
2 changed files with 2 additions and 2 deletions

View file

@ -143,7 +143,7 @@ func (s *resubscribeSub) loop() {
}
func (s *resubscribeSub) subscribe() Subscription {
subscribed := make(chan error)
subscribed := make(chan error, 1)
var sub Subscription
retry:
for {

View file

@ -287,7 +287,7 @@ func (n *ExecNode) Stop() error {
if err := n.Cmd.Process.Signal(syscall.SIGTERM); err != nil {
return n.Cmd.Process.Kill()
}
waitErr := make(chan error)
waitErr := make(chan error, 1)
go func() {
waitErr <- n.Cmd.Wait()
}()