Skip to content

Commit

Permalink
Same logic in scoreMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Mar 20, 2022
1 parent cbbb790 commit 8419b56
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ts/score/scoreMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,20 @@ export function computeScoreWeights(
}

// P2: first message deliveries
const p2 = tstats.firstMessageDeliveries
let p2 = tstats.firstMessageDeliveries
if (p2 > topicParams.firstMessageDeliveriesCap) {
p2 = topicParams.firstMessageDeliveriesCap
}
p2w += p2 * topicParams.firstMessageDeliveriesWeight

// P3: mesh message deliveries
if (tstats.meshMessageDeliveriesActive) {
if (tstats.meshMessageDeliveries < topicParams.meshMessageDeliveriesThreshold) {
const deficit = topicParams.meshMessageDeliveriesThreshold - tstats.meshMessageDeliveries
const p3 = deficit * deficit
p3w += p3 * topicParams.meshMessageDeliveriesWeight
}
if (
tstats.meshMessageDeliveriesActive &&
tstats.meshMessageDeliveries < topicParams.meshMessageDeliveriesThreshold
) {
const deficit = topicParams.meshMessageDeliveriesThreshold - tstats.meshMessageDeliveries
const p3 = deficit * deficit
p3w += p3 * topicParams.meshMessageDeliveriesWeight
}

// P3b:
Expand Down

0 comments on commit 8419b56

Please sign in to comment.