Closed ViToni closed 2 weeks ago
@MattBrittan The PR now has been updated. Hopefully it looks more Go-ish now. I'd be more than happy for any feedback.
Things covered in this update:
ConnectRetryDelay
if it is set and no strategy was configured@MattBrittan The PR now has been updated. Hopefully it looks more Go-ish now. I'd be more than happy for any feedback.
Thanks - I'll try to have a look next week (sorry, have limited time to spend on this currently). Update 20th May - still struggling for time; took a quick look but really need to pull the repo and work through it in detail. I am really keen to see this address the situation where the broker drops the connection soon after it comes up (as this is quite a common issue).
Superseded by #258.
This PR introduces the ability to use a backoff strategy for reconnect attempts.
As default a backoff strategy is used whichs return the same backoff value mimicking the previous behaviour. In addition there is an exponential backoff available which will increase the max value on each attempt up to a configurable limit. The created backoff is a random value between a configured non-zero minimum and the increasing max (up to the configured limit). Using a random value from an increasing range helps spread client reconnect attempts.
Testing
Existing code has been changed to use the same duration as before but now uses the constant backoff implementation instead. All tests pass.
Additionally there are dedicated tests for:
Closing issues
closes #249 `