You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For instance, when trying to connect to a Zk server that is not running, how can we abord the connection attempt ?
According to the following snippet,
automain() -> int
{
try
{
auto client_future = zk::client::connect("zk://127.0.0.1:2181"); // local server which is currently stoppedusingnamespacestd::chrono_literals;constauto wait_result = client_future.wait_for(2s);
if (wait_result != std::future_status::ready)
{
throw std::runtime_error{ "timeout 1" }; // reached, but after throw(),// the code flow go back to `auto client_future = zk::client::connect("zk://127.0.0.1:2181");`
}
}
catch (const std::runtime_error& error)
{ // never reached
std::cerr << "error : " << error.what() << '\n';
}
return0;
The text was updated successfully, but these errors were encountered:
auto client = zk::client{zk::connection::connect(/*args...*/)}
Having zk::client::connect::get blocking the current thread as long as the client is not connected is not a viable option as we do not have cancelation in the current future implementation.
Is there a way to cancel connection ?
For instance, when trying to connect to a Zk server that is not running, how can we abord the connection attempt ?
According to the following snippet,
The text was updated successfully, but these errors were encountered: