From a32b98b15bba51f0b0050e3e65de61380f40ca23 Mon Sep 17 00:00:00 2001 From: yair Date: Mon, 11 Dec 2023 18:27:07 +0200 Subject: [PATCH] at the start of polling getting the current state --- pkg/event_listener/polling/polling.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/event_listener/polling/polling.go b/pkg/event_listener/polling/polling.go index d4ec0a2..cb32ad8 100644 --- a/pkg/event_listener/polling/polling.go +++ b/pkg/event_listener/polling/polling.go @@ -1,7 +1,6 @@ package polling import ( - "github.com/port-labs/port-k8s-exporter/pkg/port" "github.com/port-labs/port-k8s-exporter/pkg/port/cli" "github.com/port-labs/port-k8s-exporter/pkg/port/integration" "k8s.io/klog/v2" @@ -29,7 +28,10 @@ func NewPollingHandler(pollingRate int, stateKey string, portClient *cli.PortCli func (h *PollingHandler) Run(resync func()) { klog.Infof("Starting polling handler") - currentState := &port.AppConfig{} + currentState, err := integration.GetIntegrationConfig(h.portClient, h.stateKey) + if err != nil { + klog.Errorf("Error fetching the first AppConfig state: %s", err.Error()) + } sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)