improve grpc lifecycle
This commit is contained in:
@ -62,6 +62,8 @@ func InitGRPCServer(ctx context.Context, opts *opts.GRPCOpts) (
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
appGRPC.logger.Debug().Msg("GRPC Server Started")
|
||||
|
||||
span.SetStatus(codes.Ok, "")
|
||||
return appGRPC.shutdownFunc, appGRPC.doneChan, nil
|
||||
}
|
||||
|
@ -56,8 +56,11 @@ func (a *appGRPCServer) getShutdownFunc() func(context.Context) error {
|
||||
|
||||
select {
|
||||
case <-stoppedChan:
|
||||
a.logger.Warn().Msg("GRPC server shut down gracefully")
|
||||
return nil
|
||||
case <-ctx.Done():
|
||||
a.logger.Warn().Msg("GRPC server shut down hard")
|
||||
a.server.Stop()
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user