Skip to content

Commit

Permalink
r/consensus: coroutinized raft::stop() method
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Aug 1, 2022
1 parent 8de704b commit acde644
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/v/raft/consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,16 @@ ss::future<> consensus::stop() {
for (auto& idx : _fstats) {
idx.second.follower_state_change.broken();
}
return _event_manager.stop()
.then([this] { return _append_requests_buffer.stop(); })
.then([this] { return _batcher.stop(); })
.then([this] { return _bg.close(); })
.then([this] {
// close writer if we have to
if (likely(!_snapshot_writer)) {
return ss::now();
}
return _snapshot_writer->close().then(
[this] { _snapshot_writer.reset(); });
});
co_await _event_manager.stop();
co_await _append_requests_buffer.stop();
co_await _batcher.stop();
co_await _bg.close();

// close writer if we have to
if (unlikely(_snapshot_writer)) {
co_await _snapshot_writer->close();
_snapshot_writer.reset();
}
}

consensus::success_reply consensus::update_follower_index(
Expand Down

0 comments on commit acde644

Please sign in to comment.