@@ -168,14 +168,12 @@ func (iw *InstanceWatcherService) ReparseConfig(ctx context.Context, instanceID
168168 }
169169 }
170170
171- slog .Info ("Send Config Context Update - Reparse config" , "instance_id" , instanceID )
172171 iw .sendNginxConfigContextUpdate (ctx , nginxConfigContext )
173- iw .updateCache ( nginxConfigContext )
172+ iw .nginxConfigCache [ nginxConfigContext . InstanceID ] = nginxConfigContext
174173 updatesRequired = proto .UpdateNginxInstanceRuntime (instance , nginxConfigContext )
175174 }
176175
177176 if updatesRequired {
178- slog .Info ("Instance Update Required" )
179177 instanceUpdates := InstanceUpdates {}
180178 instanceUpdates .UpdatedInstances = append (instanceUpdates .UpdatedInstances , instance )
181179 iw .instancesChannel <- InstanceUpdatesMessage {
@@ -185,17 +183,6 @@ func (iw *InstanceWatcherService) ReparseConfig(ctx context.Context, instanceID
185183 }
186184}
187185
188- func (iw * InstanceWatcherService ) updateCache (nginxConfigContext * model.NginxConfigContext ) {
189- iw .nginxConfigCache [nginxConfigContext .InstanceID ] = nginxConfigContext
190- slog .Info ("Instance Update Cache - New Context" , "url" , & nginxConfigContext .StubStatus .URL ,
191- "location" , nginxConfigContext .StubStatus .Location ,
192- "listen" , nginxConfigContext .StubStatus .Listen )
193- slog .Info ("Instance Update Cache - Cache " , "url" ,
194- iw .nginxConfigCache [nginxConfigContext .InstanceID ].StubStatus .URL ,
195- "location" , iw .nginxConfigCache [nginxConfigContext .InstanceID ].StubStatus .Location ,
196- "listen" , iw .nginxConfigCache [nginxConfigContext .InstanceID ].StubStatus .Listen )
197- }
198-
199186func (iw * InstanceWatcherService ) checkForUpdates (
200187 ctx context.Context ,
201188) {
@@ -233,9 +220,8 @@ func (iw *InstanceWatcherService) checkForUpdates(
233220 "error" , parseErr ,
234221 )
235222 } else {
236- slog .Info ("Send Config Context Update - check for updates" )
237223 iw .sendNginxConfigContextUpdate (newCtx , nginxConfigContext )
238- iw .updateCache ( nginxConfigContext )
224+ iw .nginxConfigCache [ nginxConfigContext . InstanceID ] = nginxConfigContext
239225 proto .UpdateNginxInstanceRuntime (newInstance , nginxConfigContext )
240226 iw .instanceCache [newInstance .GetInstanceMeta ().GetInstanceId ()] = newInstance
241227 }
@@ -255,28 +241,8 @@ func (iw *InstanceWatcherService) sendNginxConfigContextUpdate(
255241 ctx context.Context ,
256242 nginxConfigContext * model.NginxConfigContext ,
257243) {
258- if iw .nginxConfigCache [nginxConfigContext .InstanceID ] == nil {
259- slog .Info ("iw.nginxConfigCache[nginxConfigContext.InstanceID] == nil" )
260- slog .DebugContext (
261- ctx ,
262- "New NGINX config context" ,
263- "instance_id" , nginxConfigContext .InstanceID ,
264- "nginx_config_context" , nginxConfigContext ,
265- )
266-
267- iw .nginxConfigContextChannel <- NginxConfigContextMessage {
268- CorrelationID : logger .GetCorrelationIDAttr (ctx ),
269- NginxConfigContext : nginxConfigContext ,
270- }
271- } else if ! iw .nginxConfigCache [nginxConfigContext .InstanceID ].Equal (nginxConfigContext ) {
272- slog .Info ("!iw.nginxConfigCache[nginxConfigContext.InstanceID].Equal(nginxConfigContext)" )
273- slog .Info ("Check Cache - Cache " , "url" ,
274- iw .nginxConfigCache [nginxConfigContext .InstanceID ].StubStatus .URL ,
275- "location" , iw .nginxConfigCache [nginxConfigContext .InstanceID ].StubStatus .Location ,
276- "listen" , iw .nginxConfigCache [nginxConfigContext .InstanceID ].StubStatus .Listen )
277- slog .Info ("Check Cache - New Context" , "url" , nginxConfigContext .StubStatus .URL ,
278- "location" , nginxConfigContext .StubStatus .Location ,
279- "listen" , nginxConfigContext .StubStatus .Listen )
244+ if iw .nginxConfigCache [nginxConfigContext .InstanceID ] == nil ||
245+ ! iw .nginxConfigCache [nginxConfigContext .InstanceID ].Equal (nginxConfigContext ) {
280246 slog .DebugContext (
281247 ctx ,
282248 "New NGINX config context" ,
0 commit comments