Fix test data race

This commit is contained in:
Ola
2024-03-06 12:31:16 +01:00
parent f3ccd79a30
commit 87e736d0f6
+4 -3
View File
@@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"sync"
"sync/atomic"
"testing"
"testing/quick"
"time"
@@ -790,9 +791,9 @@ func TestConcurrentMessageHandling(t *testing.T) {
ws.m.Config.ConcurrentMessageHandling = cmh
ws.m.Config.PongWait = base
var errorSet bool
var errorSet atomic.Bool
ws.m.HandleError(func(s *Session, err error) {
errorSet = true
errorSet.Store(true)
done <- struct{}{}
})
@@ -811,7 +812,7 @@ func TestConcurrentMessageHandling(t *testing.T) {
<-done
return errorSet
return errorSet.Load()
}
t.Run("text should error", func(t *testing.T) {