Skip to content

Commit 295b564

Browse files
committedAug 27, 2020
fix priority calculation
1 parent 90a1c98 commit 295b564

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎lib/reducePlan.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ module.exports = (plan, limit) => {
7070
// Reduce until limit reached
7171
while (currentCount > limit) {
7272
// Select node that helps reaching the limit most effectively without overmerging
73-
const overLimit = limit - currentCount;
73+
const overLimit = currentCount - limit;
7474
let bestNode = undefined;
7575
let bestCost = Infinity;
7676
for (const node of treeMap.values()) {
7777
if (node.entries <= 1 || !node.children) continue;
78-
if (node.children.length <= 1) continue;
78+
if (node.children.length === 0) continue;
79+
if (node.children.length === 1 && !node.value) continue;
7980
// Try to select the node with has just a bit more entries than we need to reduce
8081
// When just a bit more is over 30% over the limit,
8182
// also consider just a bit less entries then we need to reduce

0 commit comments

Comments
 (0)
Please sign in to comment.