|
@ -3,6 +3,7 @@ package events |
|
|
import ( |
|
|
import ( |
|
|
"context" |
|
|
"context" |
|
|
"fmt" |
|
|
"fmt" |
|
|
|
|
|
"math/rand" |
|
|
"testing" |
|
|
"testing" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
@ -10,7 +11,6 @@ import ( |
|
|
"github.com/stretchr/testify/require" |
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
|
|
|
|
"github.com/tendermint/tendermint/libs/log" |
|
|
"github.com/tendermint/tendermint/libs/log" |
|
|
"github.com/tendermint/tendermint/libs/rand" |
|
|
|
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
// TestAddListenerForEventFireOnce sets up an EventSwitch, subscribes a single
|
|
|
// TestAddListenerForEventFireOnce sets up an EventSwitch, subscribes a single
|
|
@ -469,7 +469,7 @@ func TestRemoveListenersAsync(t *testing.T) { |
|
|
// collect received events for event2
|
|
|
// collect received events for event2
|
|
|
go sumReceivedNumbers(numbers2, doneSum2) |
|
|
go sumReceivedNumbers(numbers2, doneSum2) |
|
|
addListenersStress := func() { |
|
|
addListenersStress := func() { |
|
|
r1 := rand.NewRand() |
|
|
|
|
|
|
|
|
r1 := rand.New(rand.NewSource(time.Now().Unix())) |
|
|
r1.Seed(time.Now().UnixNano()) |
|
|
r1.Seed(time.Now().UnixNano()) |
|
|
for k := uint16(0); k < 400; k++ { |
|
|
for k := uint16(0); k < 400; k++ { |
|
|
listenerNumber := r1.Intn(100) + 3 |
|
|
listenerNumber := r1.Intn(100) + 3 |
|
@ -480,7 +480,7 @@ func TestRemoveListenersAsync(t *testing.T) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
removeListenersStress := func() { |
|
|
removeListenersStress := func() { |
|
|
r2 := rand.NewRand() |
|
|
|
|
|
|
|
|
r2 := rand.New(rand.NewSource(time.Now().Unix())) |
|
|
r2.Seed(time.Now().UnixNano()) |
|
|
r2.Seed(time.Now().UnixNano()) |
|
|
for k := uint16(0); k < 80; k++ { |
|
|
for k := uint16(0); k < 80; k++ { |
|
|
listenerNumber := r2.Intn(100) + 3 |
|
|
listenerNumber := r2.Intn(100) + 3 |
|
|