VOL-2021 - default health check to true
also add nil check in case k8s closes before received is defined
Change-Id: Ic60d4ad005e79ff758a3fe09c0886a8398c2401b
diff --git a/ro_core/core/core.go b/ro_core/core/core.go
index cd27a42..8b0317b 100644
--- a/ro_core/core/core.go
+++ b/ro_core/core/core.go
@@ -86,11 +86,19 @@
func (core *Core) Stop(ctx context.Context) {
log.Info("stopping-adaptercore")
- core.exitChannel <- 1
+ if core.exitChannel != nil {
+ core.exitChannel <- 1
+ }
// Stop all the started services
- core.grpcServer.Stop()
- core.logicalDeviceMgr.stop(ctx)
- core.deviceMgr.stop(ctx)
+ if core.grpcServer != nil {
+ core.grpcServer.Stop()
+ }
+ if core.logicalDeviceMgr != nil {
+ core.logicalDeviceMgr.stop(ctx)
+ }
+ if core.deviceMgr != nil {
+ core.deviceMgr.stop(ctx)
+ }
log.Info("adaptercore-stopped")
}