From e16cff6952cdc0cdb60171dcd205d1dc63626aed Mon Sep 17 00:00:00 2001 From: Calle Wilund Date: Tue, 29 Jun 2021 15:56:58 +0000 Subject: [PATCH] commitlog: coroutinize commitlog::add --- db/commitlog/commitlog.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index ca23b38a19..a758c016a9 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -2045,10 +2045,9 @@ future db::commitlog::add(const cf_id_type& id, res = std::move(h); } }; - auto writer = ::make_shared(id, size, std::move(func), sync); - return _segment_manager->allocate_when_possible(*writer, timeout).then([writer] { - return std::move(writer->res); - }); + serializer_func_entry_writer writer(id, size, std::move(func), sync); + co_await _segment_manager->allocate_when_possible(writer, timeout); + co_return std::move(writer.res); } future db::commitlog::add_entry(const cf_id_type& id, const commitlog_entry_writer& cew, timeout_clock::time_point timeout)