From: Samuel Just Date: Tue, 4 Jun 2019 23:48:12 +0000 (-0700) Subject: common/Throttle: maintain count even if disabled X-Git-Tag: v15.1.0~1367^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dbf1d2a53508eb0781390d64117becf76a057fbe;p=ceph-ci.git common/Throttle: maintain count even if disabled Otherwise, it will behave incorrectly if enabled dynamically. Signed-off-by: Samuel Just --- 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; }