diff --git a/mutation_writer/feed_writers.hh b/mutation_writer/feed_writers.hh index 2a564d5122..792a46ec06 100644 --- a/mutation_writer/feed_writers.hh +++ b/mutation_writer/feed_writers.hh @@ -8,6 +8,8 @@ #pragma once +#include + #include "readers/queue.hh" namespace mutation_writer { @@ -63,14 +65,15 @@ future<> feed_writer(mutation_reader&& rd_ref, Writer wr) { } } - try { - co_await wr.close(); - } catch (...) { + auto f = co_await coroutine::as_future(wr.close()); + if (f.failed()) [[unlikely]] { + // Need to consume the failed future exception even if not used + auto close_ex = f.get_exception(); if (!ex) { - ex = std::current_exception(); + ex = std::move(close_ex); } } - if (ex) { + if (ex) [[unlikely]] { std::rethrow_exception(ex); } }