mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-04 05:43:06 +00:00
Fix race in the TestTopicRelayReuse
This commit is contained in:
parent
10f5464279
commit
f4f8f3ec12
@ -619,7 +619,13 @@ func TestTopicRelayReuse(t *testing.T) {
|
|||||||
|
|
||||||
time.Sleep(time.Millisecond * 100)
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
|
||||||
if pubsubs[0].myRelays[topic] != 3 {
|
res := make(chan bool, 1)
|
||||||
|
pubsubs[0].eval <- func() {
|
||||||
|
res <- pubsubs[0].myRelays[topic] == 3
|
||||||
|
}
|
||||||
|
|
||||||
|
isCorrectNumber := <-res
|
||||||
|
if !isCorrectNumber {
|
||||||
t.Fatal("incorrect number of relays")
|
t.Fatal("incorrect number of relays")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +635,12 @@ func TestTopicRelayReuse(t *testing.T) {
|
|||||||
|
|
||||||
time.Sleep(time.Millisecond * 100)
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
|
||||||
if pubsubs[0].myRelays[topic] != 0 {
|
pubsubs[0].eval <- func() {
|
||||||
|
res <- pubsubs[0].myRelays[topic] == 0
|
||||||
|
}
|
||||||
|
|
||||||
|
isCorrectNumber = <-res
|
||||||
|
if !isCorrectNumber {
|
||||||
t.Fatal("incorrect number of relays")
|
t.Fatal("incorrect number of relays")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user