From 6bf4d25778664159f50e5dad90e5e53a77e7e6c9 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Sat, 24 Nov 2018 18:14:45 -0500 Subject: [PATCH] rgw: RGWReshardWait takes duration as argument Signed-off-by: Casey Bodley --- src/rgw/rgw_reshard.cc | 6 ++---- src/rgw/rgw_reshard.h | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index 7dc50ce0717..3c7096af68e 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -862,8 +862,6 @@ int RGWReshard::clear_bucket_resharding(const string& bucket_instance_oid, cls_r return 0; } -static const std::chrono::seconds default_reshard_sleep_duration(5); - int RGWReshardWait::wait(optional_yield y) { std::unique_lock lock(mutex); @@ -881,7 +879,7 @@ int RGWReshardWait::wait(optional_yield y) waiters.push_back(waiter); lock.unlock(); - waiter.timer.expires_after(default_reshard_sleep_duration); + waiter.timer.expires_after(duration); boost::system::error_code ec; waiter.timer.async_wait(yield[ec]); @@ -892,7 +890,7 @@ int RGWReshardWait::wait(optional_yield y) } #endif - cond.wait_for(lock, default_reshard_sleep_duration); + cond.wait_for(lock, duration); if (going_down) { return -ECANCELED; diff --git a/src/rgw/rgw_reshard.h b/src/rgw/rgw_reshard.h index a715c5df1a6..d27fe7e079b 100644 --- a/src/rgw/rgw_reshard.h +++ b/src/rgw/rgw_reshard.h @@ -173,6 +173,7 @@ public: }; class RGWReshardWait { + const ceph::timespan duration; ceph::mutex mutex = ceph::make_mutex("RGWReshardWait::lock"); ceph::condition_variable cond; @@ -186,7 +187,8 @@ class RGWReshardWait { bool going_down{false}; public: - RGWReshardWait() = default; + RGWReshardWait(ceph::timespan duration = std::chrono::seconds(5)) + : duration(duration) {} ~RGWReshardWait() { ceph_assert(going_down); } -- 2.39.5