Skip to content

Commit be029fa

Browse files
authored
Move version in event handler (#1622)
1 parent 721255c commit be029fa

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

internal/mode/static/handler.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ type eventHandlerConfig struct {
7777
nginxConfiguredOnStartChecker *nginxConfiguredOnStartChecker
7878
// controlConfigNSName is the NamespacedName of the NginxGateway config for this controller.
7979
controlConfigNSName types.NamespacedName
80-
// version is the current version number of the nginx config.
81-
version int
8280
}
8381

8482
// filterKey is the `kind_namespace_name" of an object being filtered.
@@ -107,6 +105,9 @@ type eventHandlerImpl struct {
107105

108106
cfg eventHandlerConfig
109107
lock sync.Mutex
108+
109+
// version is the current version number of the nginx config.
110+
version int
110111
}
111112

112113
// newEventHandlerImpl creates a new eventHandlerImpl.
@@ -177,8 +178,8 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Log
177178
}
178179
return
179180
case state.EndpointsOnlyChange:
180-
h.cfg.version++
181-
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.cfg.version)
181+
h.version++
182+
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.version)
182183

183184
h.setLatestConfiguration(&cfg)
184185

@@ -188,8 +189,8 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Log
188189
cfg,
189190
)
190191
case state.ClusterStateChange:
191-
h.cfg.version++
192-
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.cfg.version)
192+
h.version++
193+
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.version)
193194

194195
h.setLatestConfiguration(&cfg)
195196

0 commit comments

Comments
 (0)