Skip to content

Commit 1c1ca26

Browse files
committed
Fix retry logic not to attempt to retry on an open circuit breaker.
Fix: #227
1 parent 69243e9 commit 1c1ca26

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- Fix retry logic not to attempt to retry on an open circuit breaker. Fix #227.
4+
35
# 0.23.1
46

57
- Fix a potential crash in `hiredis-client` when using subcriptions (`next_event`). See #221.

lib/redis_client.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,9 +710,14 @@ def ensure_connected(retryable: true)
710710
end
711711
rescue ConnectionError, ProtocolError => error
712712
preferred_error ||= error
713-
preferred_error = error unless error.is_a?(CircuitBreaker::OpenCircuitError)
714713
close
715714

715+
if error.is_a?(CircuitBreaker::OpenCircuitError)
716+
raise preferred_error
717+
else
718+
preferred_error = error
719+
end
720+
716721
if !@disable_reconnection && config.retry_connecting?(tries, error)
717722
tries += 1
718723
retry

0 commit comments

Comments
 (0)