From c33eab5f2bd5f075147d6f4c1c26783317ef492e Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Fri, 19 Dec 2025 11:02:49 +0000 Subject: [PATCH] Ensure watchers are enabled before handling NGINX config context update --- internal/watcher/watcher_plugin.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/watcher/watcher_plugin.go b/internal/watcher/watcher_plugin.go index 8f19f9226..4cefade38 100644 --- a/internal/watcher/watcher_plugin.go +++ b/internal/watcher/watcher_plugin.go @@ -186,12 +186,6 @@ func (w *Watcher) handleEnableWatchers(ctx context.Context, msg *bus.Message) { instanceID := enableWatchersMessage.InstanceID configContext := enableWatchersMessage.ConfigContext - // if config apply ended in a reload there is no need to reparse the config so an empty config context is sent - // from the file plugin - if configContext.InstanceID != "" { - w.instanceWatcherService.HandleNginxConfigContextUpdate(ctx, instanceID, configContext) - } - w.watcherMutex.Lock() w.instancesWithConfigApplyInProgress = slices.DeleteFunc( w.instancesWithConfigApplyInProgress, @@ -203,6 +197,12 @@ func (w *Watcher) handleEnableWatchers(ctx context.Context, msg *bus.Message) { w.fileWatcherService.EnableWatcher(ctx) w.instanceWatcherService.SetEnabled(true) w.watcherMutex.Unlock() + + // if config apply ended in a reload there is no need to reparse the config so an empty config context is sent + // from the file plugin + if configContext.InstanceID != "" { + w.instanceWatcherService.HandleNginxConfigContextUpdate(ctx, instanceID, configContext) + } } func (w *Watcher) handleConfigApplyRequest(ctx context.Context, msg *bus.Message) {