add ctx to goroutine
@@ -195,9 +195,14 @@ func (a *App) handleGetRequestEvent(ctx context.Context, req *gnmi.GetRequest, e
}
responses := make(map[string][]*formatters.EventMsg)
go func() {
- for r := range rsps {
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case r := <-rsps:
responses[r.name] = r.rsp
}
+ }
}()
a.wg.Wait()
close(rsps)
