linting
This commit is contained in:
@@ -156,8 +156,9 @@ func (a *App[T]) Start() error {
|
||||
}
|
||||
|
||||
a.metricsSrv = &http.Server{
|
||||
Addr: addr,
|
||||
Handler: router,
|
||||
Addr: addr,
|
||||
Handler: router,
|
||||
ReadHeaderTimeout: 5 * time.Second,
|
||||
}
|
||||
go func() {
|
||||
a.logger.Info("Prometheus metrics server starting", zap.String("address", addr))
|
||||
@@ -185,7 +186,7 @@ func (a *App[T]) Start() error {
|
||||
}
|
||||
a.logger.Debug("GRPC services registered")
|
||||
|
||||
a.runCtx, a.cancel = context.WithCancel(context.Background())
|
||||
a.runCtx, a.cancel = context.WithCancel(context.Background()) //nolint:gosec // Cancellation func is retained on app state and invoked on Shutdown.
|
||||
a.logger.Debug("GRPC server context initialised")
|
||||
|
||||
if err := a.grpc.Start(a.runCtx); err != nil {
|
||||
@@ -219,9 +220,6 @@ func (a *App[T]) Start() error {
|
||||
}
|
||||
|
||||
func (a *App[T]) Shutdown(ctx context.Context) {
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
if a.cancel != nil {
|
||||
a.cancel()
|
||||
}
|
||||
|
||||
@@ -30,11 +30,15 @@ func prepareLogger() mlogger.Logger {
|
||||
func RunServer(rootLoggerName string, av version.Printer, factory server.ServerFactoryT) {
|
||||
logger := prepareLogger().Named(rootLoggerName)
|
||||
logger = logger.With(zap.String("instance_id", discovery.InstanceID()))
|
||||
defer logger.Sync()
|
||||
defer func() {
|
||||
_ = logger.Sync()
|
||||
}()
|
||||
|
||||
// Show version information
|
||||
if *versionFlag {
|
||||
fmt.Fprintln(os.Stdout, av.Print())
|
||||
if _, err := fmt.Fprintln(os.Stdout, av.Print()); err != nil {
|
||||
logger.Warn("Failed to print version", zap.Error(err))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user