Skip to content

Commit

Permalink
revert unregister discovery and bundle listeners post successful startup
Browse files Browse the repository at this point in the history
Signed-off-by: Pushpalanka Jayawardhana <[email protected]>
  • Loading branch information
Pushpalanka committed Oct 19, 2024
1 parent 8b57401 commit b504ce0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions filters/openpolicyagent/openpolicyagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
})
})
}
Expand All @@ -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)

Expand Down

0 comments on commit b504ce0

Please sign in to comment.