Cylix / cpp_redis

C++11 Lightweight Redis client: async, thread-safe, no dependency, pipelining, multi-platform - NO LONGER MAINTAINED - Please check https://github.com/cpp-redis/cpp_redis
MIT License
1.24k stars 551 forks source link

Add public reconnect functions to the client and subscriber #167

Closed nkochakian closed 6 years ago

nkochakian commented 6 years ago

I have an application that opens several connections to a Redis database, all of which need to be synchronized (they all need to be connected before doing anything.) I noticed that there are situations where one connection will drop and the others won't change states for a while (they sometimes won't detect a disconnection until well after the reconnect delay for the first client has passed.)

It would be helpful if there was an accessible reconnect function so that it would be possible to force every client to disconnect and attempt to reconnect at about the same time.

Cylix commented 6 years ago

Hi @nkochakian,

A reconnect function would be the equivalent of a .disconnect() followed by a .connect(). If so, I prefer not to provide such a function to avoid possible confusion with .connect(). Or are you looking for a different behavior in the .reconnect() function?

Best

nkochakian commented 6 years ago

I have decided to manage the connection sequence manually instead of using the automatic reconnect feature