Skip to content

Commit

Permalink
fix: remove lock acquisition in ClusterCache.GetAPIResources()
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Suen <[email protected]>
  • Loading branch information
jessesuen committed Oct 6, 2023
1 parent a00ce82 commit fc49f37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cache/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ func (c *clusterCache) GetServerVersion() string {
}

// GetAPIResources returns information about observed API resources
// This method is called frequently during reconciliation to pass API resource info to `helm template`
func (c *clusterCache) GetAPIResources() []kube.APIResourceInfo {
c.lock.RLock()
defer c.lock.RUnlock()

// c.lock is unnecessary to acquire when returning c.apiResources since lists are safe to access
// concurrently and we anyway don't provide any consistency guarantees if updated while iterated
return c.apiResources
}

Expand Down

0 comments on commit fc49f37

Please sign in to comment.