From dd666cfd08f64847115591314825f2ac873bb712 Mon Sep 17 00:00:00 2001 From: saipubw Date: Wed, 19 Jul 2023 17:25:01 +0800 Subject: [PATCH] [coro_io] reconnect immediately at first try (#377) --- include/ylt/coro_io/client_pool.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/ylt/coro_io/client_pool.hpp b/include/ylt/coro_io/client_pool.hpp index 878c139f5..b66bd2ced 100644 --- a/include/ylt/coro_io/client_pool.hpp +++ b/include/ylt/coro_io/client_pool.hpp @@ -99,8 +99,7 @@ class client_pool : public std::enable_shared_from_this< async_simple::coro::Lazy> reconnect( std::unique_ptr client) { - bool ok = false; - + bool ok = client_t::is_ok(co_await client->reconnect(host_name_)); for (int i = 0; !ok && i < pool_config_.connect_retry_count; ++i) { co_await coro_io::sleep_for(pool_config_.reconnect_wait_time); ok = (client_t::is_ok(co_await client->reconnect(host_name_)));