@@ -170,7 +170,7 @@ func (iw *InstanceWatcherService) ReparseConfig(ctx context.Context, instanceID
170170
171171 slog .Info ("Send Config Context Update - Reparse config" , "instance_id" , instanceID )
172172 iw .sendNginxConfigContextUpdate (ctx , nginxConfigContext )
173- iw .nginxConfigCache [ nginxConfigContext . InstanceID ] = nginxConfigContext
173+ iw .updateCache ( nginxConfigContext )
174174 updatesRequired = proto .UpdateNginxInstanceRuntime (instance , nginxConfigContext )
175175 }
176176
@@ -185,6 +185,17 @@ func (iw *InstanceWatcherService) ReparseConfig(ctx context.Context, instanceID
185185 }
186186}
187187
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+
188199func (iw * InstanceWatcherService ) checkForUpdates (
189200 ctx context.Context ,
190201) {
@@ -224,7 +235,7 @@ func (iw *InstanceWatcherService) checkForUpdates(
224235 } else {
225236 slog .Info ("Send Config Context Update - check for updates" )
226237 iw .sendNginxConfigContextUpdate (newCtx , nginxConfigContext )
227- iw .nginxConfigCache [ nginxConfigContext . InstanceID ] = nginxConfigContext
238+ iw .updateCache ( nginxConfigContext )
228239 proto .UpdateNginxInstanceRuntime (newInstance , nginxConfigContext )
229240 iw .instanceCache [newInstance .GetInstanceMeta ().GetInstanceId ()] = newInstance
230241 }
@@ -259,6 +270,13 @@ func (iw *InstanceWatcherService) sendNginxConfigContextUpdate(
259270 }
260271 } else if ! iw .nginxConfigCache [nginxConfigContext .InstanceID ].Equal (nginxConfigContext ) {
261272 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 )
262280 slog .DebugContext (
263281 ctx ,
264282 "New NGINX config context" ,
0 commit comments