Skip to content

Commit bb6bee4

Browse files
committed
Ensure watchers are enabled before handling NGINX config context update
1 parent f4a3c33 commit bb6bee4

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

api/grpc/mpi/v1/command.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/common.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/files.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/watcher/watcher_plugin.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,6 @@ func (w *Watcher) handleEnableWatchers(ctx context.Context, msg *bus.Message) {
186186
instanceID := enableWatchersMessage.InstanceID
187187
configContext := enableWatchersMessage.ConfigContext
188188

189-
// if config apply ended in a reload there is no need to reparse the config so an empty config context is sent
190-
// from the file plugin
191-
if configContext.InstanceID != "" {
192-
w.instanceWatcherService.HandleNginxConfigContextUpdate(ctx, instanceID, configContext)
193-
}
194-
195189
w.watcherMutex.Lock()
196190
w.instancesWithConfigApplyInProgress = slices.DeleteFunc(
197191
w.instancesWithConfigApplyInProgress,
@@ -203,6 +197,12 @@ func (w *Watcher) handleEnableWatchers(ctx context.Context, msg *bus.Message) {
203197
w.fileWatcherService.EnableWatcher(ctx)
204198
w.instanceWatcherService.SetEnabled(true)
205199
w.watcherMutex.Unlock()
200+
201+
// if config apply ended in a reload there is no need to reparse the config so an empty config context is sent
202+
// from the file plugin
203+
if configContext.InstanceID != "" {
204+
w.instanceWatcherService.HandleNginxConfigContextUpdate(ctx, instanceID, configContext)
205+
}
206206
}
207207

208208
func (w *Watcher) handleConfigApplyRequest(ctx context.Context, msg *bus.Message) {

0 commit comments

Comments
 (0)