Skip to content

Commit ff82de6

Browse files
committed
Add mutex lock to nginxConfigCache in instance watcher service
1 parent 0a7daab commit ff82de6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/watcher/instance/instance_watcher_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ func (iw *InstanceWatcherService) checkForUpdates(
218218
"error", parseErr,
219219
)
220220
} else {
221+
iw.cacheMutex.Lock()
221222
iw.sendNginxConfigContextUpdate(newCtx, nginxConfigContext)
222223
proto.UpdateNginxInstanceRuntime(newInstance, nginxConfigContext)
223224

224-
iw.cacheMutex.Lock()
225225
iw.nginxConfigCache[nginxConfigContext.InstanceID] = nginxConfigContext
226226
iw.instanceCache[newInstance.GetInstanceMeta().GetInstanceId()] = newInstance
227227
iw.cacheMutex.Unlock()

0 commit comments

Comments
 (0)