-
-
Notifications
You must be signed in to change notification settings - Fork 189
Define optional delay time between (Connection) retries #120
Comments
This seems like a useful feature for all of the Currently, the non-Connection classes take options as constructor parameters. It may make more sense to pass around the Configuration object. I'm open to suggestions on that -- sadly, it'd be a BC break. This also seems relevant: http://en.wikipedia.org/wiki/Exponential_backoff |
I went through all Is there possibility that we'll get "nested" retry loops? Something like an error occurs in |
I don't think nested retry loops are desirable, because then the retry logic would certainly exceed the number of attempts and delay (if any). Also, Connection only retries when initializing and attempting to connect, which are distinct from the actions that a Database or Collection would retry. I've already removed the command prefix arguments in #131, so constructor signatures are definitely changing for 1.1. I would like to get this feature into 1.1 stable (or an ensuing patch release), and will attempt to utilize some configuration object as you said instead of tacking on new constructor arguments. |
In case that a connection error happens,
Connection::retry()
loops configured amount of times. It would be useful in connection errors that the library would sleep a second before a new try: that would allow for example primary failover to complete better.Optionally, the sleep time could be exponential: first retry immediately, second retry after 1 second sleep, third reply after 2 seconds and so on.
I am happy to contribute with the code if this feature is considered useful in general.
The text was updated successfully, but these errors were encountered: