andymccurdy/redis-py — pull request #570 by nfvs (2014-12-10 13:34:55+00:00)
Title: Implement connection retries in connect().

This PR adds the ability to attempt reconnecting when there is a connection failure, with a configurable number of retries and wait duration.

`reconnect_on_timeout` enables a reconnection attempt when the connection is broken, but only once, and if `connect()` fails an exception is thrown. This is maintained by default with this PR.

But by passing a `connection_retries=X` argument to `Connection()`, a reconnection will be retried X number of times. A `connection_retry_wait=Y` makes it possible to wait Y seconds between connection retries.