Azure-Samples/azure-cache-redis-samples

Why create a reconnection logic other than the offered in StackExchange.Redis package?

Closed this issue · 2 comments

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [X] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

N/A

Any log messages given by the failure

N/A

Expected/desired behavior

N/A

OS and Version?

N/A

Versions

N/A

Mention any other details that might be useful

Just a question to understand the reason behind handling reconnection manually instead of relying on the logic offered by the library (ref: https://stackexchange.github.io/StackExchange.Redis/Configuration.html#reconnectretrypolicy). Is there an edge case not covered by the native retry feature?

Hi @ricardomomm in older versions of StackExchange.Redis (and in other Redis client libraries) there are various issues that can interfere with the library's ability to automatically restore connections internally. As a backstop for those edge cases, we recommended a ForceReconnect pattern to replace the entire connection object that may be stuck in a bad state with a fresh instance that's more likely to connect successfully.

The latest versions of StackExchange.Redis contain fixes for all such edge cases that we've detected, and internal connection restoration is now very reliable. As long as you're on a recent version (and updating regularly), it's unlikely that you'll need to implement ForceReconnect.

Thanks for the quick feedback @philon-msft , we are on latest StackExchange.Redis so we are safe then.