From 377955f35df03eb6c8bc589118109a4466b146cd Mon Sep 17 00:00:00 2001 From: Tongliang Deng Date: Thu, 16 Jun 2022 03:46:30 +0000 Subject: [PATCH] rgwlc: fix backoff sleep_ms always 0 SimpleBackoff from c069eb7ff09b52003fa00a5cc83b1e52370032f5 has `sleep_ms` which is wrongly set to 0 after the first iteration. Fix it with first retry as no-op sleep call. Signed-off-by: Tongliang Deng --- src/rgw/rgw_lc.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index da2bd841e5832..85d3da663ea16 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -1671,9 +1671,7 @@ public: if (r) { return r; } - std::this_thread::sleep_for(sleep_ms); - sleep_ms = std::chrono::milliseconds(sleep_ms*2*retries); - ++retries; + std::this_thread::sleep_for(sleep_ms * 2 * retries++); } return false; } -- 2.39.5