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/rw_core/core/core.go b/rw_core/core/core.go
index e74e869..f22f8b8 100644
--- a/rw_core/core/core.go
+++ b/rw_core/core/core.go
@@ -136,12 +136,22 @@
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)
- core.kmp.Stop()
+ if core.grpcServer != nil {
+ core.grpcServer.Stop()
+ }
+ if core.logicalDeviceMgr != nil {
+ core.logicalDeviceMgr.stop(ctx)
+ }
+ if core.deviceMgr != nil {
+ core.deviceMgr.stop(ctx)
+ }
+ if core.kmp != nil {
+ core.kmp.Stop()
+ }
log.Info("adaptercore-stopped")
}