File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,12 +223,10 @@ func TestStringPoolRaceCondition(t *testing.T) {
223223 pool := NewStringPool ()
224224
225225 var wg sync.WaitGroup
226- wg .Add (numGoroutines * 3 )
227226
228227 // Concurrent interning of identical strings
229228 for range numGoroutines {
230229 wg .Go (func () {
231- defer wg .Done ()
232230 for range numOps {
233231 pool .Intern ("shared" )
234232 }
@@ -238,17 +236,16 @@ func TestStringPoolRaceCondition(t *testing.T) {
238236 // Concurrent interning of unique strings
239237 for i := range numGoroutines {
240238 wg .Go (func () {
241- defer wg .Done ()
242239 for j := range numOps {
243240 pool .Intern (fmt .Sprintf ("unique-%d-%d" , i , j ))
244241 }
245242 })
246243 }
247244
248- // Concurrent clear operations
249- for range numGoroutines {
245+ // Use a small number of goroutines to exercise the race detector without triggering
246+ // resize contention in xsync.Map.
247+ for range 10 {
250248 wg .Go (func () {
251- defer wg .Done ()
252249 for range numOps {
253250 pool .clear ()
254251 }
You can’t perform that action at this time.
0 commit comments