From dbf1d2a53508eb0781390d64117becf76a057fbe Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 4 Jun 2019 16:48:12 -0700 Subject: [PATCH] common/Throttle: maintain count even if disabled Otherwise, it will behave incorrectly if enabled dynamically. Signed-off-by: Samuel Just --- src/common/Throttle.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index 50a835ee5f1..69d0f1086b0 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -151,6 +151,7 @@ int64_t Throttle::take(int64_t c) bool Throttle::get(int64_t c, int64_t m) { if (0 == max && 0 == m) { + count += c; return false; } @@ -183,6 +184,7 @@ bool Throttle::get(int64_t c, int64_t m) bool Throttle::get_or_fail(int64_t c) { if (0 == max) { + count += c; return true; } @@ -211,6 +213,7 @@ bool Throttle::get_or_fail(int64_t c) int64_t Throttle::put(int64_t c) { if (0 == max) { + count -= c; return 0; } -- 2.39.5