Skip to content

Commit cd02890

Browse files
committed
Fix naming
1 parent 89a9ae2 commit cd02890

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

internal/watcher/instance/nginx-app-protect-instance-watcher.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type NginxAppProtectInstanceWatcher struct {
4040
watcher *fsnotify.Watcher
4141
instancesChannel chan<- InstanceUpdatesMessage
4242
nginxAppProtectInstance *mpi.Instance
43-
filesBeingWatcher map[string]bool
43+
filesBeingWatched map[string]bool
4444
version string
4545
release string
4646
attackSignatureVersion string
@@ -51,7 +51,7 @@ type NginxAppProtectInstanceWatcher struct {
5151
func NewNginxAppProtectInstanceWatcher(agentConfig *config.Config) *NginxAppProtectInstanceWatcher {
5252
return &NginxAppProtectInstanceWatcher{
5353
agentConfig: agentConfig,
54-
filesBeingWatcher: make(map[string]bool),
54+
filesBeingWatched: make(map[string]bool),
5555
}
5656
}
5757

@@ -72,7 +72,7 @@ func (w *NginxAppProtectInstanceWatcher) Watch(ctx context.Context, instancesCha
7272
w.watcher = watcher
7373
w.instancesChannel = instancesChannel
7474

75-
w.watchDirectories(ctx)
75+
w.watchVersionFiles(ctx)
7676

7777
instanceWatcherTicker := time.NewTicker(monitoringFrequency)
7878
defer instanceWatcherTicker.Stop()
@@ -88,7 +88,7 @@ func (w *NginxAppProtectInstanceWatcher) Watch(ctx context.Context, instancesCha
8888
return
8989
case <-instanceWatcherTicker.C:
9090
// Need to keep watching directories in case NAP gets installed a while after NGINX Agent is started
91-
w.watchDirectories(ctx)
91+
w.watchVersionFiles(ctx)
9292
w.checkForUpdates(ctx)
9393
case event := <-w.watcher.Events:
9494
w.handleEvent(ctx, event)
@@ -98,16 +98,16 @@ func (w *NginxAppProtectInstanceWatcher) Watch(ctx context.Context, instancesCha
9898
}
9999
}
100100

101-
func (w *NginxAppProtectInstanceWatcher) watchDirectories(ctx context.Context) {
101+
func (w *NginxAppProtectInstanceWatcher) watchVersionFiles(ctx context.Context) {
102102
for _, versionFile := range versionFiles {
103-
if !w.filesBeingWatcher[versionFile] {
103+
if !w.filesBeingWatched[versionFile] {
104104
if _, fileOs := os.Stat(versionFile); fileOs != nil && os.IsNotExist(fileOs) {
105-
w.filesBeingWatcher[versionFile] = false
105+
w.filesBeingWatched[versionFile] = false
106106
continue
107107
}
108108

109109
w.addWatcher(ctx, versionFile)
110-
w.filesBeingWatcher[versionFile] = true
110+
w.filesBeingWatched[versionFile] = true
111111

112112
// On startup we need to read the files initially if they are discovered for the first time
113113
w.readVersionFile(ctx, versionFile)

0 commit comments

Comments
 (0)