Skip to content

Commit

Permalink
node: fix bug in decaying max conns by 25%
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Sep 1, 2023
1 parent c72821c commit ca7ee20
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,9 @@ function adjustMaxConns(n) {
n = Math.max((n * 0.6) | 0, minc);
} else {
// reclaim adjs 25% at a time as n approaches maxconns
adj = Math.min(0, adj * 0.75) | 0;
// ex: if adj is 100, then the decay would be,
// [75, 56, 42, 31, 23, 17, 12, 9, 6, 4, 3, 2, 1, 0]
adj = Math.max(0, adj * 0.75) | 0;
}
} else {
// clamp n based on a preset
Expand Down

0 comments on commit ca7ee20

Please sign in to comment.