mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-19 18:21:34 +02:00
lru: using max to simplify the if statement
Includes-commit: 6d2613d254
Replicated-from: https://github.com/cloudflare/pingora/pull/130
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
This commit is contained in:
parent
3675d35f1c
commit
99cb79bf2b
2 changed files with 2 additions and 2 deletions
2
.bleep
2
.bleep
|
@ -1 +1 @@
|
|||
d2b0975beaec744968a4936eb80483fac65f7e35
|
||||
802590d7d04730c3e93f9c2335175990eee1fb92
|
|
@ -68,7 +68,7 @@ impl<T, const N: usize> Lru<T, N> {
|
|||
|
||||
// Make sure weight is positive otherwise eviction won't work
|
||||
// TODO: Probably should use NonZeroUsize instead
|
||||
let weight = if weight == 0 { 1 } else { weight };
|
||||
let weight = weight.max(1);
|
||||
|
||||
let old_weight = unit.admit(key, data, weight);
|
||||
if old_weight != weight {
|
||||
|
|
Loading…
Reference in a new issue