2
0
mirror of https://github.com/boostorg/redis.git synced 2026-01-19 04:42:09 +00:00

Changes cancel_on_connection_lost default to false and deprecates it (#329)

* Changes cancel_on_connection_lost default to false
* Deprecates cancel_on_connection_lost and cancel_if_not_connected
* Fixes a TODO in test_conn_exec_cancel

close #323
This commit is contained in:
Anarthal (Rubén Pérez)
2025-10-11 13:30:41 +02:00
committed by GitHub
parent 35fa68b926
commit 28ed27ce72
4 changed files with 19 additions and 12 deletions

View File

@@ -101,7 +101,7 @@ void test_error_code()
// This request will complete after the health checker deems the connection
// as unresponsive and triggers a reconnection (it's configured to be cancelled
// on connection lost).
// if unresponded).
conn.async_exec(req, ignore, [&](error_code ec, std::size_t) {
exec_finished = true;
BOOST_TEST_EQ(ec, net::error::operation_aborted);

View File

@@ -39,10 +39,6 @@ using boost::redis::logger;
using boost::redis::connection;
using namespace std::chrono_literals;
// TODO: replace this by connection once it supports asio::cancel_after
// See https://github.com/boostorg/redis/issues/226
using connection_type = boost::redis::basic_connection<net::any_io_executor>;
namespace {
// We can cancel requests that haven't been written yet.
@@ -95,7 +91,7 @@ void test_cancel_written()
{
// Setup
net::io_context ctx;
connection_type conn{ctx};
connection conn{ctx};
auto cfg = make_test_config();
cfg.health_check_interval = std::chrono::seconds::zero();
bool run_finished = false, exec1_finished = false, exec2_finished = false,