- /* When Redis has max amount of users, it will still accept new connections but will
- * close them immediately. Therefore, we need to verify that just established connection
- * really works. This prevents calling client readyAck callback for a connection that
- * will be terminated immediately.
- */
- /* Connection verification is now done by doing redis command list query. Because we anyway
- * need to verify that Redis has required commands, we can now combine these two operations
- * (command list query and connection verification). If either one of the functionalities
- * is not needed in the future and it is removed, remember to still leave the other one.
- */
- serviceState = ServiceState::CONNECTION_VERIFICATION;
- /* Disarm retry timer as now we are connected to hiredis. This ensures timer disarm if
- * we are spontaneously connected to redis while timer is running. If connection verification
- * fails, timer is armed again (normal handling in connection verification).
- */
- connectionRetryTimer.disarm();
- dispatchAsync(std::bind(&AsyncHiredisCommandDispatcher::verifyConnectionReply,
- this,
- std::placeholders::_1,
- std::placeholders::_2),
- contentsBuilder->build("COMMAND"),
- false);
+ if (usedForSentinel)
+ setConnected();
+ else
+ {
+ /* When Redis has max amount of users, it will still accept new connections but will
+ * close them immediately. Therefore, we need to verify that just established connection
+ * really works. This prevents calling client readyAck callback for a connection that
+ * will be terminated immediately.
+ */
+ /* Connection verification is now done by doing redis command list query. Because we anyway
+ * need to verify that Redis has required commands, we can now combine these two operations
+ * (command list query and connection verification). If either one of the functionalities
+ * is not needed in the future and it is removed, remember to still leave the other one.
+ */
+ serviceState = ServiceState::CONNECTION_VERIFICATION;
+ /* Disarm retry timer as now we are connected to hiredis. This ensures timer disarm if
+ * we are spontaneously connected to redis while timer is running. If connection verification
+ * fails, timer is armed again (normal handling in connection verification).
+ */
+ connectionRetryTimer.disarm();
+ dispatchAsync(std::bind(&AsyncHiredisCommandDispatcher::verifyConnectionReply,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2),
+ contentsBuilder->build("COMMAND"),
+ false);
+ }