From 1bb3db9c6742f08ad21a67d331a4aa3301e53d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6hrl?= Date: Sun, 11 Feb 2024 17:17:31 +0100 Subject: [PATCH] fix: revert locking in getclusteraccessor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lukas Wöhrl --- controller/sharding/cache.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controller/sharding/cache.go b/controller/sharding/cache.go index 29a0a69fda6b5..7e2c37a2c37ee 100644 --- a/controller/sharding/cache.go +++ b/controller/sharding/cache.go @@ -154,8 +154,7 @@ func hasShardingUpdates(old, new *v1alpha1.Cluster) bool { func (d *ClusterSharding) GetClusterAccessor() clusterAccessor { return func() []*v1alpha1.Cluster { - d.lock.RLock() - defer d.lock.RUnlock() + // no need to lock, as this is only called from the updateDistribution function clusters := make([]*v1alpha1.Cluster, 0, len(d.Clusters)) for _, c := range d.Clusters { clusters = append(clusters, c)