seafile: use atomic types

This commit is contained in:
Roberto Ricci 2023-08-18 16:29:18 +02:00 committed by Nick Craig-Wood
parent a56c11753a
commit c624dd5c3a

View File

@ -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))