fix (controller): prevent panic when controller stops when there's no listener (#2793)

This commit is contained in:
Jim authored and GitHub committed 2023-01-18 16:46:45 -05:00
1 parent 0d621b4520
commit e64163ad1d
1 file changed
+4 -3
+4 -3
View File
@@ -321,10 +321,11 @@ func (c *Controller) stopApiGrpcServerAndListener() error {
if c.apiGrpcServer == nil {
return nil
}
c.apiGrpcServer.GracefulStop()
err := c.apiGrpcServerListener.Close()
return listenerCloseErrorCheck("ch", err) // apiGrpcServerListener is just a channel, so the type here is not important.
if c.apiGrpcServerListener != nil {
return listenerCloseErrorCheck("ch", c.apiGrpcServerListener.Close()) // apiGrpcServerListener is just a channel, so the type here is not important.
}
return nil
}
// stopAnyListeners does a final once over the known