routing: stronger use of direct bimodal probability
The process how we calculate a total probability from the direct and node probability is modified to give more importance to the direct probability. This is important if we know about a recent failure. We should not try to send over this channel again if we know we can't. Otherwise this can lead to infinite retrials over the channel, when the probability is pinned at high probabilities by the other node results.
This commit is contained in:
2 files changed
+70
-12
No files matched your search
@@ -308,6 +308,32 @@ func (p *BimodalEstimator) calculateProbability(directProbability float64,
|
||||
return directProbability
|
||||
}
|
||||
|
||||
// If we have up-to-date information about the channel we want to use,
|
||||
// i.e. the info stems from results not longer ago than the decay time,
|
||||
// we will only use the direct probability. This is needed in order to
|
||||
// avoid that other previous results (on all other channels of the same
|
||||
// routing node) will distort and pin the calculated probability even if
|
||||
// we have accurate direct information. This helps to dip the
|
||||
// probability below the min probability in case of failures, to start
|
||||
// the splitting process.
|
||||
directResult, ok := results[toNode]
|
||||
if ok {
|
||||
latest := directResult.SuccessTime
|
||||
if directResult.FailTime.After(latest) {
|
||||
latest = directResult.FailTime
|
||||
}
|
||||
|
||||
// We use BimonodalDecayTime to judge the currentness of the
|
||||
// data. It is the time scale on which we assume to have lost
|
||||
// information.
|
||||
if now.Sub(latest) < p.BimodalDecayTime {
|
||||
log.Tracef("Using direct probability for node %v: %v",
|
||||
toNode, directResult)
|
||||
|
||||
return directProbability
|
||||
}
|
||||
}
|
||||
|
||||
// w is a parameter which determines how strongly the other channels of
|
||||
// a node should be incorporated, the higher the stronger.
|
||||
w := p.BimodalNodeWeight
|
||||
|
||||
Reference in new issue
Block a user