mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network/stream: only count first iteration of subscriptions
This commit is contained in:
parent
eb86e581c6
commit
1aff836004
1 changed files with 7 additions and 2 deletions
|
|
@ -1189,7 +1189,7 @@ func TestGetSubscriptionsRPC(t *testing.T) {
|
||||||
// arbitrarily set to 4
|
// arbitrarily set to 4
|
||||||
nodeCount := 4
|
nodeCount := 4
|
||||||
// set the syncUpdateDelay for sync registrations to start
|
// set the syncUpdateDelay for sync registrations to start
|
||||||
syncUpdateDelay := 800 * time.Millisecond
|
syncUpdateDelay := 200 * time.Millisecond
|
||||||
// run with more nodes if `longrunning` flag is set
|
// run with more nodes if `longrunning` flag is set
|
||||||
if *longrunning {
|
if *longrunning {
|
||||||
nodeCount = 64
|
nodeCount = 64
|
||||||
|
|
@ -1207,7 +1207,12 @@ func TestGetSubscriptionsRPC(t *testing.T) {
|
||||||
|
|
||||||
// we use this subscriptionFunc for this test: just increases count and calls the actual subscription
|
// we use this subscriptionFunc for this test: just increases count and calls the actual subscription
|
||||||
subscriptionFunc = func(r *Registry, p *network.Peer, bin uint8, subs map[enode.ID]map[Stream]struct{}) bool {
|
subscriptionFunc = func(r *Registry, p *network.Peer, bin uint8, subs map[enode.ID]map[Stream]struct{}) bool {
|
||||||
|
// syncing starts after syncUpdateDelay and loops after that Duration; we only want to count at the first iteration
|
||||||
|
// in the first iteration, subs will be empty (no existing subscriptions), thus we can use this check
|
||||||
|
// this avoids flakyness
|
||||||
|
if len(subs) == 0 {
|
||||||
expectedMsgCount.inc()
|
expectedMsgCount.inc()
|
||||||
|
}
|
||||||
doRequestSubscription(r, p, bin, subs)
|
doRequestSubscription(r, p, bin, subs)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue