instead of using a lambda, use a future variable for reducing the indent
level.
Signed-off-by: Kefu Chai <kchai@redhat.com>
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) {