-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
second call to async_exec hangs and never returns #182
Comments
TL;DR: Pass the credentials to boost::redis::config cfg;
cfg.username = "username";
cfg.password = "password";
cfg.addr.host = "host";
cfg.addr.port = "port";
conn.async_run(cfg, {}, [](auto ec) { });
I believe the problem is that the conn.async_run(cfg, {boost::redis::logger::level::debug}, [](auto ec) { }); and sent it here so I can analyse the problem.
Yes, that is the correct way of using Boost.Redis. Most of the time you only need one connection. |
Hi Marcelo, I changed the code (bellow) but the situation persists. I noted that if I remove the need of password to connect (requirepass my_psw), everything works. I'm not using username on the configuration, btw. I also collected the debug info for you to check. (Boost.Redis) run-all-op: resolve addresses 127.0.0.1:6379
Thank you very much, |
Then please set cfg.username = "default"; Let me know if it works. |
Yep, it does work! Thanks again. |
Hi,
I'm planning to replace my redis connection with boost.redis using coroutines. I was testing the code bellow but I noticed that it aways freezes at the second call to async_exec. Any idea what I'm doing wrong? My plan is to keep the connection to the database open and re-use it always when is necessary.
auto
receiver(std::shared_ptr conn) -> asio::awaitable
{
request auth_req;
auth_req.push("AUTH", "my_psw");
boost::redis::responsestd::string auth_resp;
co_await conn->async_exec(auth_req, auth_resp, boost::asio::use_awaitable);
std::cout << "AUTH: " << std::get<0>(auth_resp).value() << std::endl;
std::get<0>(auth_resp).value().clear();
request ping_req;
auth_req.push("PING");
boost::redis::responsestd::string ping_resp;
co_await conn->async_exec(ping_req, ping_resp, boost::asio::use_awaitable);
std::cout << "PING: " << std::get<0>(ping_resp).value() << std::endl;
std::get<0>(ping_resp).value().clear();
The text was updated successfully, but these errors were encountered: