refactor: rename gr to group

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-02-25 12:33:19 +01:00
parent 9cffca70f2
commit 24a1103f11
No known key found for this signature in database
GPG Key ID: 34CC109EB5ED1C2A

View File

@ -333,7 +333,7 @@ func runServe(options serveOptions) error {
InitiallyPassing: true, InitiallyPassing: true,
}) })
var gr run.Group var group run.Group
// Set up telemetry server // Set up telemetry server
if c.Telemetry.HTTP != "" { if c.Telemetry.HTTP != "" {
@ -351,7 +351,7 @@ func runServe(options serveOptions) error {
} }
defer server.Close() defer server.Close()
gr.Add(func() error { group.Add(func() error {
return server.Serve(l) return server.Serve(l)
}, func(err error) { }, func(err error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
@ -380,7 +380,7 @@ func runServe(options serveOptions) error {
} }
defer server.Close() defer server.Close()
gr.Add(func() error { group.Add(func() error {
return server.Serve(l) return server.Serve(l)
}, func(err error) { }, func(err error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
@ -414,7 +414,7 @@ func runServe(options serveOptions) error {
} }
defer server.Close() defer server.Close()
gr.Add(func() error { group.Add(func() error {
return server.ServeTLS(l, c.Web.TLSCert, c.Web.TLSKey) return server.ServeTLS(l, c.Web.TLSCert, c.Web.TLSKey)
}, func(err error) { }, func(err error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
@ -445,7 +445,7 @@ func runServe(options serveOptions) error {
reflection.Register(grpcSrv) reflection.Register(grpcSrv)
} }
gr.Add(func() error { group.Add(func() error {
return grpcSrv.Serve(grpcListener) return grpcSrv.Serve(grpcListener)
}, func(err error) { }, func(err error) {
logger.Debugf("starting graceful shutdown (grpc)") logger.Debugf("starting graceful shutdown (grpc)")
@ -453,8 +453,8 @@ func runServe(options serveOptions) error {
}) })
} }
gr.Add(run.SignalHandler(context.Background(), os.Interrupt, syscall.SIGTERM)) group.Add(run.SignalHandler(context.Background(), os.Interrupt, syscall.SIGTERM))
if err := gr.Run(); err != nil { if err := group.Run(); err != nil {
if _, ok := err.(run.SignalError); !ok { if _, ok := err.(run.SignalError); !ok {
return fmt.Errorf("run groups: %w", err) return fmt.Errorf("run groups: %w", err)
} }