From c624dd5c3aa978a7bc95e4712da8525c6c4f2cf4 Mon Sep 17 00:00:00 2001 From: Roberto Ricci Date: Fri, 18 Aug 2023 16:29:18 +0200 Subject: [PATCH] seafile: use atomic types --- backend/seafile/renew_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/seafile/renew_test.go b/backend/seafile/renew_test.go index 610f553fd..845693e44 100644 --- a/backend/seafile/renew_test.go +++ b/backend/seafile/renew_test.go @@ -17,17 +17,17 @@ func TestShouldAllowShutdownTwice(t *testing.T) { } func TestRenewalInTimeLimit(t *testing.T) { - var count int64 + var count atomic.Int64 renew := NewRenew(100*time.Millisecond, func() error { - atomic.AddInt64(&count, 1) + count.Add(1) return nil }) time.Sleep(time.Second) renew.Shutdown() // there's no guarantee the CI agent can handle a simple goroutine - renewCount := atomic.LoadInt64(&count) + renewCount := count.Load() t.Logf("renew count = %d", renewCount) assert.Greater(t, renewCount, int64(0)) assert.Less(t, renewCount, int64(11))