]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: reduce the indent
authorKefu Chai <kchai@redhat.com>
Sun, 28 Feb 2021 05:19:56 +0000 (13:19 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 28 Feb 2021 06:06:05 +0000 (14:06 +0800)
instead of using a lambda, use a future variable for reducing the indent
level.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd_operations/peering_event.cc

index d3c6ccf817f822b993aa34c089b7a91a95833621..2372adb328eb0a8116cd7718c721d7f72b063915 100644 (file)
@@ -53,14 +53,12 @@ seastar::future<> PeeringEvent::start()
   logger().debug("{}: start", *this);
 
   IRef ref = this;
-  return [this] {
-    if (delay) {
-      return seastar::sleep(std::chrono::milliseconds(
-               std::lround(delay*1000)));
-    } else {
-      return seastar::now();
-    }
-  }().then([this] {
+  auto maybe_delay = seastar::now();
+  if (delay) {
+    maybe_delay = seastar::sleep(
+      std::chrono::milliseconds(std::lround(delay * 1000)));
+  }
+  return maybe_delay.then([this] {
     return get_pg();
   }).then([this](Ref<PG> pg) {
     if (!pg) {