finetune sticky mesh failure penalty parameter

This commit is contained in:
vyzo 2020-03-09 01:17:11 +02:00
parent f40b06e515
commit 48b7d01113
1 changed files with 5 additions and 2 deletions

View File

@ -383,8 +383,11 @@ func (ps *peerScore) Prune(p peer.ID, topic string) {
return
}
if tstats.meshMessageDeliveriesActive && tstats.meshMessageDeliveries < ps.params.Topics[topic].MeshMessageDeliveriesThreshold {
tstats.meshFailurePenalty += 1
// sticky mesh delivery rate failure penalty
threshold := ps.params.Topics[topic].MeshMessageDeliveriesThreshold
if tstats.meshMessageDeliveriesActive && tstats.meshMessageDeliveries < threshold {
deficit := threshold - tstats.meshMessageDeliveries
tstats.meshFailurePenalty += deficit * deficit
}
tstats.inMesh = false