Skip to content

Commit f1136e3

Browse files
committed
Improves reconnection responsiveness.
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.
1 parent e8dd4d6 commit f1136e3

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,12 @@ https://lists.boost.org/Archives/boost/2023/01/253944.php.
676676

677677
## Changelog
678678

679+
### Boost 1.87
680+
681+
* ([Issue 205](https://github.com/boostorg/redis/issues/205))
682+
Improves reaction time to disconnection by using `wait_for_one_error`
683+
instead of `wait_for_all`.
684+
679685
### Boost 1.85
680686

681687
* ([Issue 170](https://github.com/boostorg/redis/issues/170))

include/boost/redis/detail/runner.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class runner_op {
9393
[this](auto token) { return runner_->health_checker_.async_check_health(*conn_, logger_, token); },
9494
[this](auto token) { return runner_->async_hello(*conn_, logger_, token); }
9595
).async_wait(
96-
asio::experimental::wait_for_all(),
96+
asio::experimental::wait_for_one_error(),
9797
std::move(self));
9898

9999
logger_.on_runner(ec0, ec1, ec2);

test/test_conn_exec.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ BOOST_AUTO_TEST_CASE(correct_database)
152152
auto const pos = value.find("db=");
153153
auto const index_str = value.substr(pos + 3, 1);
154154
auto const index = std::stoi(index_str);
155+
156+
// This check might fail if more than one client is connected to
157+
// redis when the CLIENT LIST command is run.
155158
BOOST_CHECK_EQUAL(cfg.database_index.value(), index);
156159
}
157160

0 commit comments

Comments
 (0)