I'm currently trying to implement connection retrying for the client right now. I'm doing this by subclassing the Client class and adding a wrapper around Client.connect() to retry some amount of times.
It works well for me because I always try to connect manually before I attempt any commands, but there are many places where the Client checks the connection and instead of using Client.connect() it directly just uses Client.connection.connect().
except Exception as e:
self.command_stack = []
self.connection.disconnect()
raise e
I see no reason for this, and changing all of these to use the methods on Client instead of Client.connection would make adding in reconnects and retries much easier. I will happily submit a pull request, but I just wanted to make sure that there was no reason for the current way before I did.
I'm currently trying to implement connection retrying for the client right now. I'm doing this by subclassing the Client class and adding a wrapper around Client.connect() to retry some amount of times.
It works well for me because I always try to connect manually before I attempt any commands, but there are many places where the Client checks the connection and instead of using Client.connect() it directly just uses Client.connection.connect().
https://github.com/leporo/tornado-redis/blob/master/tornadoredis/client.py#L1305-1306
The same goes for many disconnects.
https://github.com/leporo/tornado-redis/blob/master/tornadoredis/client.py#L1317-L1320
I see no reason for this, and changing all of these to use the methods on Client instead of Client.connection would make adding in reconnects and retries much easier. I will happily submit a pull request, but I just wanted to make sure that there was no reason for the current way before I did.
Thanks