les/vflux/server: fix priority cornercase causing fuzzer timeout (#22650)
* les/vflux/server: fix estimatePriority corner case * les/vflux/server: simplify inactiveAllowance == 0 case
This commit is contained in:
@@ -358,11 +358,15 @@ func (n *nodeBalance) estimatePriority(capacity uint64, addBalance int64, future
|
||||
if bias > 0 {
|
||||
b = n.reducedBalance(b, now+mclock.AbsTime(future), bias, capacity, 0)
|
||||
}
|
||||
// Note: we subtract one from the estimated priority in order to ensure that biased
|
||||
// estimates are always lower than actual priorities, even if the bias is very small.
|
||||
pri := n.balanceToPriority(now, b, capacity)
|
||||
// Ensure that biased estimates are always lower than actual priorities, even if
|
||||
// the bias is very small.
|
||||
// This ensures that two nodes will not ping-pong update signals forever if both of
|
||||
// them have zero estimated priority drop in the projected future.
|
||||
pri := n.balanceToPriority(now, b, capacity) - 1
|
||||
current := n.balanceToPriority(now, n.balance, capacity)
|
||||
if pri >= current {
|
||||
pri = current - 1
|
||||
}
|
||||
if update {
|
||||
n.addCallback(balanceCallbackUpdate, pri, n.signalPriorityUpdate)
|
||||
}
|
||||
|
Reference in New Issue
Block a user