mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-05 22:33:10 +00:00
tweak probability threshold
This commit is contained in:
parent
ff1b1a9772
commit
955344bf9b
@ -165,12 +165,12 @@ func (pg *peerGater) AcceptFrom(p peer.ID) AcceptStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we make a randomized decision based on the goodput of the peer
|
// we make a randomized decision based on the goodput of the peer
|
||||||
goodput := st.deliver / total
|
threshold := (1 + st.deliver) / (1 + total)
|
||||||
if rand.Float64() < goodput {
|
if rand.Float64() < threshold {
|
||||||
return AcceptAll
|
return AcceptAll
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("throttling peer %s with goodput %f", p, goodput)
|
log.Debugf("throttling peer %s with threshold %f", p, threshold)
|
||||||
return AcceptControl
|
return AcceptControl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user