Skip to content

Commit

Permalink
fix Mutex review issue
Browse files Browse the repository at this point in the history
Signed-off-by: seeflood <[email protected]>
  • Loading branch information
seeflood committed Aug 24, 2022
1 parent a8e4b14 commit 4e84a63
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/grpc/lifecycle/grpc_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func checkDynamicComponent(kind string, name string, store interface{}, componen
name: name,
}] = &dynamicComponentHolder{
DynamicComponent: comp,
Mutex: sync.Mutex{},
mu: sync.Mutex{},
}
}

Expand All @@ -100,7 +100,7 @@ type componentKey struct {

type dynamicComponentHolder struct {
common.DynamicComponent
sync.Mutex
mu sync.Mutex
}

func (s *server) ApplyConfiguration(ctx context.Context, in *runtimev1pb.DynamicConfiguration) (*runtimev1pb.ApplyConfigurationResponse, error) {
Expand Down Expand Up @@ -135,8 +135,8 @@ func (s *server) ApplyConfiguration(ctx context.Context, in *runtimev1pb.Dynamic
}

// 3. lock
holder.Lock()
defer holder.Unlock()
holder.mu.Lock()
defer holder.mu.Unlock()

// 4. delegate to components
err := holder.ApplyConfig(ctx, in.GetComponentConfig().Metadata)
Expand Down

0 comments on commit 4e84a63

Please sign in to comment.