From a38cad65bd5604bfeeaf236ec47acbef021caaad Mon Sep 17 00:00:00 2001 From: Dave Shanley Date: Sun, 30 Jul 2023 04:05:58 -0400 Subject: [PATCH] Added check for hook Signed-off-by: Dave Shanley --- plank/pkg/server/initialize.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plank/pkg/server/initialize.go b/plank/pkg/server/initialize.go index bf83ef5..a7ee7d3 100644 --- a/plank/pkg/server/initialize.go +++ b/plank/pkg/server/initialize.go @@ -116,10 +116,12 @@ func (ps *platformServer) initialize() { // REST bridge setup done. now wait for service to be ready if val, found := svcReadyStore.Get(request.ServiceChannel); !found || !val.(bool) { - readyChan := hooks.OnServiceReady() - svcReadyStore.Put(request.ServiceChannel, <-readyChan, service.ServiceInitStateChange) + if hooks != nil { + readyChan := hooks.OnServiceReady() + svcReadyStore.Put(request.ServiceChannel, <-readyChan, service.ServiceInitStateChange) + close(readyChan) + } utils.Log.Infof("[ranch] Service '%s' initialized successfully", reflect.TypeOf(fabricSvc).String()) - close(readyChan) } }, func(err error) {