Skip to content

Commit

Permalink
Improves reconnection responsiveness.
Browse files Browse the repository at this point in the history
As the user points out in

   #205

wait_for_all might be the cause of delay in the
reconnection. I could not observe any improvement in my
local setup but wait_for_one_error look the correct token
and all tests pass so I am willing to change it.
  • Loading branch information
mzimbres committed Aug 18, 2024
1 parent e8dd4d6 commit f1136e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,12 @@ https://lists.boost.org/Archives/boost/2023/01/253944.php.

## Changelog

### Boost 1.87

* ([Issue 205](https://github.com/boostorg/redis/issues/205))
Improves reaction time to disconnection by using `wait_for_one_error`
instead of `wait_for_all`.

### Boost 1.85

* ([Issue 170](https://github.com/boostorg/redis/issues/170))
Expand Down
2 changes: 1 addition & 1 deletion include/boost/redis/detail/runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class runner_op {
[this](auto token) { return runner_->health_checker_.async_check_health(*conn_, logger_, token); },
[this](auto token) { return runner_->async_hello(*conn_, logger_, token); }
).async_wait(
asio::experimental::wait_for_all(),
asio::experimental::wait_for_one_error(),
std::move(self));

logger_.on_runner(ec0, ec1, ec2);
Expand Down
3 changes: 3 additions & 0 deletions test/test_conn_exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ BOOST_AUTO_TEST_CASE(correct_database)
auto const pos = value.find("db=");
auto const index_str = value.substr(pos + 3, 1);
auto const index = std::stoi(index_str);

// This check might fail if more than one client is connected to
// redis when the CLIENT LIST command is run.
BOOST_CHECK_EQUAL(cfg.database_index.value(), index);
}

Expand Down

0 comments on commit f1136e3

Please sign in to comment.