From 1e15e1ef44dd211804cf5bc66fec42c25a993f6c Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Thu, 2 Jan 2020 17:50:44 +0200 Subject: [PATCH] commitlog: cleanup segment sync() Call cycle() only once. Message-Id: <20200102155049.21291-4-gleb@scylladb.com> --- db/commitlog/commitlog.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index aa5341eb7e..f3a331d0cc 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -597,7 +597,8 @@ public: // Note: this is not a marker for when sync was finished. // It is when it was initiated reset_sync_time(); - return _closed ? cycle(true).then([](sseg_ptr s) { return s->flush(); }) : cycle(true); + auto f = cycle(true); + return _closed ? f.then([](sseg_ptr s) { return s->flush(); }) : std::move(f); } // See class comment for info future flush(uint64_t pos = 0) {