fix path in file changed detected message (#11271)

* fix path in file changed detected message

Signed-off-by: Tom Hayward <thayward@infoblox.com>

* fix typo in log message

* explain code per review comments

---------

Signed-off-by: Tom Hayward <thayward@infoblox.com>
This commit is contained in:
Tom Hayward 2024-04-19 08:41:08 -07:00 committed by GitHub
parent af5cfbd0a2
commit 48fbdfe3ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -202,8 +202,11 @@ func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXContro
}
for _, f := range filesToWatch {
// This redeclaration is necessary for the closure to get the correct value for the iteration in go versions <1.22
// See https://go.dev/blog/loopvar-preview
f := f
_, err = file.NewFileWatcher(f, func() {
klog.InfoS("File changed detected. Reloading NGINX", "path", f)
klog.InfoS("File change detected. Reloading NGINX", "path", f)
n.syncQueue.EnqueueTask(task.GetDummyObject("file-change"))
})
if err != nil {