simplify server error handling (#4006)

This commit is contained in:
Krasi Georgiev 2018-03-25 12:05:59 +03:00 committed by Brian Brazil
parent 60dafd425c
commit 5fec98d0a7
1 changed files with 6 additions and 11 deletions

View File

@ -484,18 +484,13 @@ func (h *Handler) Run(ctx context.Context) error {
ReadTimeout: h.options.ReadTimeout,
}
go func() {
if err := httpSrv.Serve(httpl); err != nil {
level.Warn(h.logger).Log("msg", "error serving HTTP", "err", err)
}
}()
go func() {
if err := grpcSrv.Serve(grpcl); err != nil {
level.Warn(h.logger).Log("msg", "error serving gRPC", "err", err)
}
}()
errCh := make(chan error)
go func() {
errCh <- httpSrv.Serve(httpl)
}()
go func() {
errCh <- grpcSrv.Serve(grpcl)
}()
go func() {
errCh <- m.Serve()
}()