service/raft: raft_group0: fix sleep_with_exponential_backoff

It was immediately jumping to _max_retry_period.
This commit is contained in:
Kamil Braun
2022-11-25 17:06:12 +01:00
parent 8bc0af9e34
commit 580bdec875

View File

@@ -1029,7 +1029,7 @@ struct sleep_with_exponential_backoff {
static constexpr std::chrono::seconds _max_retry_period{16};
future<> operator()(abort_source& as) {
co_await sleep_abortable(_retry_period, as);
_retry_period = std::max(_retry_period * 2, _max_retry_period);
_retry_period = std::min(_retry_period * 2, _max_retry_period);
}
};