Skip to content

Commit

Permalink
commitlog: Use try_with_gate
Browse files Browse the repository at this point in the history
Now that we have try_with_gate we can use instead of futurize_invoke
and with_gate.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20200819191334.74108-1-espindola@scylladb.com>
  • Loading branch information
espindola authored and tgrabiec committed Aug 20, 2020
1 parent 10b2c23 commit 33669bd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions db/commitlog/commitlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1425,11 +1425,9 @@ future<db::commitlog::segment_manager::sseg_ptr> db::commitlog::segment_manager:
promise<> p;
_segment_allocating.emplace(p.get_future());
auto f = _segment_allocating->get_future(timeout);
futurize_invoke([this] {
return with_gate(_gate, [this] {
return new_segment().discard_result().finally([this]() {
_segment_allocating = std::nullopt;
});
try_with_gate(_gate, [this] {
return new_segment().discard_result().finally([this]() {
_segment_allocating = std::nullopt;
});
}).forward_to(std::move(p));
return f;
Expand Down

0 comments on commit 33669bd

Please sign in to comment.