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:
parent
af5cfbd0a2
commit
48fbdfe3ba
1 changed files with 4 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue