fix: server closing error handling

pull/1/head
sundowndev 2024-02-27 18:07:58 +04:00
parent 5cfc252fb0
commit 878b9f38a2
1 changed files with 4 additions and 1 deletions

View File

@ -37,9 +37,12 @@ func (s *Server) Listen(addr string) error {
func (s *Server) Close() error {
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 nil
}