Skip to content

Commit ec7e2b3

Browse files
committed
bugfix: TestFutureSetStateRaceCondition data race
A use-case from our code: a response per AppendPush(). It looks like it's enough to change the test. Part of #218
1 parent d7974ea commit ec7e2b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

future_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ func TestFutureGetIteratorError(t *testing.T) {
237237
func TestFutureSetStateRaceCondition(t *testing.T) {
238238
err := errors.New("any error")
239239
resp := &Response{}
240-
respAppend := &Response{}
241240

242241
for i := 0; i < 1000; i++ {
243242
fut := NewFuture()
244243
for j := 0; j < 9; j++ {
245244
go func(opt int) {
246245
if opt%3 == 0 {
246+
respAppend := &Response{}
247247
fut.AppendPush(respAppend)
248248
} else if opt%3 == 1 {
249249
fut.SetError(err)

0 commit comments

Comments
 (0)