Skip to content

Commit

Permalink
Move version in event handler (#1622)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciarams87 authored Feb 28, 2024
1 parent 721255c commit be029fa
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/mode/static/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ type eventHandlerConfig struct {
nginxConfiguredOnStartChecker *nginxConfiguredOnStartChecker
// controlConfigNSName is the NamespacedName of the NginxGateway config for this controller.
controlConfigNSName types.NamespacedName
// version is the current version number of the nginx config.
version int
}

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

cfg eventHandlerConfig
lock sync.Mutex

// version is the current version number of the nginx config.
version int
}

// newEventHandlerImpl creates a new eventHandlerImpl.
Expand Down Expand Up @@ -177,8 +178,8 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Log
}
return
case state.EndpointsOnlyChange:
h.cfg.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.cfg.version)
h.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.version)

h.setLatestConfiguration(&cfg)

Expand All @@ -188,8 +189,8 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Log
cfg,
)
case state.ClusterStateChange:
h.cfg.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.cfg.version)
h.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.version)

h.setLatestConfiguration(&cfg)

Expand Down

0 comments on commit be029fa

Please sign in to comment.