diff --git a/CHANGELOG.md b/CHANGELOG.md index f70a7f5..758e88c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +- Fix retry logic not to attempt to retry on an open circuit breaker. Fix #227. + # 0.23.1 - Fix a potential crash in `hiredis-client` when using subcriptions (`next_event`). See #221. diff --git a/lib/redis_client.rb b/lib/redis_client.rb index 1592f5c..e551030 100644 --- a/lib/redis_client.rb +++ b/lib/redis_client.rb @@ -710,9 +710,14 @@ def ensure_connected(retryable: true) end rescue ConnectionError, ProtocolError => error preferred_error ||= error - preferred_error = error unless error.is_a?(CircuitBreaker::OpenCircuitError) close + if error.is_a?(CircuitBreaker::OpenCircuitError) + raise preferred_error + else + preferred_error = error + end + if !@disable_reconnection && config.retry_connecting?(tries, error) tries += 1 retry