Skip to content

Commit

Permalink
Do not use atomic to lock when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ffilippopoulos committed Sep 18, 2024
1 parent 75ec992 commit d1599a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xds/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (s *Snapshotter) SnapServices(serviceStore XdsServiceStore) error {
}
s.snapNodesMu.Lock()
defer s.snapNodesMu.Unlock()
atomic.AddInt32(&s.serviceSnapVersion, 1)
s.serviceSnapVersion += int32(1)
resources := map[string][]types.Resource{
resource.ClusterType: cls,
resource.ListenerType: lsnr,
Expand Down Expand Up @@ -247,7 +247,7 @@ func (s *Snapshotter) SnapEndpoints(endpointStore XdsEndpointStore) error {
}
s.snapNodesMu.Lock()
defer s.snapNodesMu.Unlock()
atomic.AddInt32(&s.endpointsSnapVersion, 1)
s.endpointsSnapVersion += int32(1)
resources := map[string][]types.Resource{
resource.EndpointType: eds,
}
Expand Down

0 comments on commit d1599a8

Please sign in to comment.