From b2ac65bfb6fd80435a6e64f43e645892fa31ca50 Mon Sep 17 00:00:00 2001 From: blotus Date: Wed, 16 Oct 2024 16:55:18 +0200 Subject: [PATCH] avoid deadlock when deleting decisions if PAPI is half configured (#3283) --- pkg/apiserver/apiserver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index bdf2d4148cc..35f9beaf635 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -255,7 +255,7 @@ func NewServer(ctx context.Context, config *csconfig.LocalApiServerCfg) (*APISer controller.AlertsAddChan = apiClient.AlertsAddChan - if config.ConsoleConfig.IsPAPIEnabled() { + if config.ConsoleConfig.IsPAPIEnabled() && config.OnlineClient.Credentials.PapiURL != "" { if apiClient.apiClient.IsEnrolled() { log.Info("Machine is enrolled in the console, Loading PAPI Client") @@ -340,7 +340,7 @@ func (s *APIServer) initAPIC(ctx context.Context) { // csConfig.API.Server.ConsoleConfig.ShareCustomScenarios if s.apic.apiClient.IsEnrolled() { - if s.consoleConfig.IsPAPIEnabled() { + if s.consoleConfig.IsPAPIEnabled() && s.papi != nil { if s.papi.URL != "" { log.Info("Starting PAPI decision receiver") s.papi.pullTomb.Go(func() error { return s.papiPull(ctx) })