From 3c8115cd76a827a56a6745f4e8a05fc108e597a5 Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Tue, 23 Jan 2024 21:21:25 -0800 Subject: [PATCH] style --- main.go | 15 +++++++-------- main_test.go | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index dbb22a4..375e79d 100644 --- a/main.go +++ b/main.go @@ -588,10 +588,9 @@ func (c *controller) sync(ctx context.Context) { c.replicas[hashring] = *sts.Spec.Replicas if _, ok := statefulsets[hashring]; !ok { - // If not, initialize a new slice statefulsets[hashring] = []*appsv1.StatefulSet{} } - // Append the new value to the slice associated with the key + // Append the new value to the slice associated with the hashring key statefulsets[hashring] = append(statefulsets[hashring], sts.DeepCopy()) level.Info(c.logger).Log("Hashring ", hashring, " got a statefulset: ", sts.Name) @@ -826,8 +825,8 @@ func newQueue() *queue { } func (q *queue) add() { - q.Mutex.Lock() - defer q.Mutex.Unlock() + q.Lock() + defer q.Unlock() if !q.ok { return @@ -839,8 +838,8 @@ func (q *queue) add() { } func (q *queue) stop() { - q.Mutex.Lock() - defer q.Mutex.Unlock() + q.Lock() + defer q.Unlock() if !q.ok { return @@ -852,8 +851,8 @@ func (q *queue) stop() { func (q *queue) get() bool { <-q.ch - q.Mutex.Lock() - defer q.Mutex.Unlock() + q.Lock() + defer q.Unlock() return q.ok } diff --git a/main_test.go b/main_test.go index 2e16f04..4515df1 100644 --- a/main_test.go +++ b/main_test.go @@ -441,6 +441,7 @@ func TestControllerConfigmapUpdate(t *testing.T) { } } +// nolint:funlen func TestControllerWithAzAware(t *testing.T) { ctx := context.Background() port := 10901