Open aidevr opened 7 years ago
Im using connection class here is the sample code
connection::ptr_t conn = connection::create("127.0.0.1",port);
unsigned int i = 0;
while(i <numMessage) {
if(conn->is_valid())
{
cout << " valid" << endl;
}
i++;
string index = boost::lexical_cast<string>(i);
string key = "mystore"+ index;
string message = "Test message";
cout << "in here" << endl;
command t = command("SET") << key << message;
try {
conn->run(t);
} catch(std::exception &ex) {
sleep(2);
continue;
}
all iteration goes into the exception......
I got your point, unfortunately redis3m has not been built for this scenario. But if you manage to find a solution a pull request is very welcome!
I'm using redis using haproxy and not managing connections with sentinels. Sentinels is being used for automatic fail-over, when fail-over happens redis3m returns transport_failur which I have put in try catch and haved continued once the exception is caught. But my connection object gets invalid and no other command is running on that object whereas connection with haproxy remains intact. What i want is to refresh redisContext of my connection such that my connection with haproxy does not break and redisContext gets refreshed. I have used redisFreeKeepFd and redisConnectFd but I'm unable to set new context to current connection object.