Skip to content

Commit

Permalink
refactor: rename mu field to the mutex field
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Plotnikov <[email protected]>
  • Loading branch information
Philipp-Plotnikov committed Jan 30, 2024
1 parent 6f70f8a commit 613a7c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/plugin/httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

var (
httpHeaderRoute = HTTPHeaderRoute{
mu: sync.Mutex{},
mutex: sync.Mutex{},
managedRouteMap: make(map[string]int),
rule: v1beta1.HTTPRouteRule{
Matches: []v1beta1.HTTPRouteMatch{},
Expand Down
13 changes: 6 additions & 7 deletions pkg/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func (r *RpcPlugin) InitPlugin() pluginTypes.RpcError {
}
}
r.Client = clientset

return pluginTypes.RpcError{}
}

Expand Down Expand Up @@ -76,13 +75,13 @@ func (r *RpcPlugin) SetHeaderRoute(rollout *v1alpha1.Rollout, headerRouting *v1a
}
switch {
case gatewayAPIConfig.HTTPRoute != "":
httpHeaderRoute.mu.Lock()
httpHeaderRoute.mutex.Lock()
rpcError := r.setHTTPHeaderRoute(rollout, headerRouting, &gatewayAPIConfig)
if rpcError.HasError() {
httpHeaderRoute.mu.Unlock()
httpHeaderRoute.mutex.Unlock()
return rpcError
}
httpHeaderRoute.mu.Unlock()
httpHeaderRoute.mutex.Unlock()
default:
return pluginTypes.RpcError{
ErrorString: HTTPRouteFieldIsEmptyError,
Expand All @@ -109,13 +108,13 @@ func (r *RpcPlugin) RemoveManagedRoutes(rollout *v1alpha1.Rollout) pluginTypes.R
}
switch {
case gatewayAPIConfig.HTTPRoute != "":
httpHeaderRoute.mu.Lock()
httpHeaderRoute.mutex.Lock()
rpcError := r.removeHTTPManagedRoutes(rollout.Spec.Strategy.Canary.TrafficRouting.ManagedRoutes, &gatewayAPIConfig)
if rpcError.HasError() {
httpHeaderRoute.mu.Unlock()
httpHeaderRoute.mutex.Unlock()
return rpcError
}
httpHeaderRoute.mu.Unlock()
httpHeaderRoute.mutex.Unlock()
default:
return pluginTypes.RpcError{
ErrorString: HTTPRouteFieldIsEmptyError,
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type GatewayAPITrafficRouting struct {
}

type HTTPHeaderRoute struct {
mu sync.Mutex
mutex sync.Mutex
managedRouteMap map[string]int
rule v1beta1.HTTPRouteRule
}
Expand Down

0 comments on commit 613a7c7

Please sign in to comment.