Skip to content
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

Add ability to check if initial connection to server succeeded #164

Open
ferchor2003 opened this issue Oct 23, 2023 · 2 comments
Open

Add ability to check if initial connection to server succeeded #164

ferchor2003 opened this issue Oct 23, 2023 · 2 comments

Comments

@ferchor2003
Copy link

Some application will need to be able to check if initial connection to the server succeeded before sending any traffic to it.
in other words, how can an app detect if the connection is up before trying to execute an exec() call?

@mzimbres
Copy link
Collaborator

mzimbres commented Nov 3, 2023

The best way to check if a connection is up is by sending executing a command like PING with exec() command. In principle it is possible to check if the socket is open, but that is not as reliable. My recommendation however is for users to rely on the buil-in health-checker in Boost.Redis instead of trying to detect themselves. The health-checker is capable of establishing a new connection (to the same instance) when necessary.

Also, I recommend you having a look at redis::request::config to adjust the behaviour to your needs, the flag cancel_if_not_connected seems to be what you are looking for.

@mzimbres
Copy link
Collaborator

mzimbres commented Nov 4, 2023

Above I mean the flag boost::redis::request::config::cancel_if_not_connected.

Does that solve your problem? do your need any further help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants