]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: RGWReshardWait takes duration as argument
authorCasey Bodley <cbodley@redhat.com>
Sat, 24 Nov 2018 23:14:45 +0000 (18:14 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 30 Nov 2018 19:37:03 +0000 (14:37 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_reshard.cc
src/rgw/rgw_reshard.h

index 7dc50ce07178750536646153f29b06fb3f68f608..3c7096af68e4c9f4bc6c055640ce78c218788840 100644 (file)
@@ -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;
index a715c5df1a64ecd80dcf8e3e2628421c19c82306..d27fe7e079b3171d0a83f4e6d8dac5f331beb9f9 100644 (file)
@@ -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);
   }