From b504ce0a6c0552776d794b8f704f8316372f4e89 Mon Sep 17 00:00:00 2001 From: Pushpalanka Jayawardhana Date: Sat, 19 Oct 2024 10:16:08 +0200 Subject: [PATCH] revert unregister discovery and bundle listeners post successful startup Signed-off-by: Pushpalanka Jayawardhana --- filters/openpolicyagent/openpolicyagent.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/filters/openpolicyagent/openpolicyagent.go b/filters/openpolicyagent/openpolicyagent.go index 170708128d..9e6536b32c 100644 --- a/filters/openpolicyagent/openpolicyagent.go +++ b/filters/openpolicyagent/openpolicyagent.go @@ -501,6 +501,7 @@ func (opa *OpenPolicyAgentInstance) Start(ctx context.Context, timeout time.Dura discoveryPlugin.RegisterListener(DiscoveryPluginStartupListener, func(status bundle.Status) { handleStatusErrors(status, failed, "discovery plugin") }) + //defer discoveryPlugin.Unregister(DiscoveryPluginStartupListener) //ToDo }) opa.manager.RegisterPluginStatusListener(PluginStatusStartupListener, func(status map[string]*plugins.Status) { @@ -510,6 +511,7 @@ func (opa *OpenPolicyAgentInstance) Start(ctx context.Context, timeout time.Dura opa.registerBundleListenerOnce.Do(func() { bundlePlugin.Register(BundlePluginStartupListener, func(status bundle.Status) { handleStatusErrors(status, failed, "bundle plugin") + //defer bundlePlugin.Unregister(BundlePluginStartupListener) //ToDo }) }) } @@ -525,13 +527,6 @@ func (opa *OpenPolicyAgentInstance) Start(ctx context.Context, timeout time.Dura } } close(done) - - //unregister discovery and bundle plugin listeners, post successful plugin startup - discoveryPlugin.Unregister(DiscoveryPluginStartupListener) - bundlePlugin := bundle.Lookup(opa.manager) - if bundlePlugin != nil { - bundlePlugin.Unregister(BundlePluginStartupListener) - } }) defer opa.manager.UnregisterPluginStatusListener(GeneralPluginStatusStartupListener)