fix: server closing error handling
parent
5cfc252fb0
commit
878b9f38a2
|
@ -37,9 +37,12 @@ func (s *Server) Listen(addr string) error {
|
||||||
|
|
||||||
func (s *Server) Close() error {
|
func (s *Server) Close() error {
|
||||||
s.grpcSrv.GracefulStop()
|
s.grpcSrv.GracefulStop()
|
||||||
if err := s.listener.Close(); !errors.Is(err, net.ErrClosed) {
|
|
||||||
|
err := s.listener.Close()
|
||||||
|
if err != nil && !errors.Is(err, net.ErrClosed) {
|
||||||
return fmt.Errorf("error closing server: %v", err)
|
return fmt.Errorf("error closing server: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue