reputable 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/reputable/connection.rb +5 -2
- data/lib/reputable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cbabd6630a3e0d348391e2795ea58cd8a858944101b0ac8a0dfaa04277b16035
|
|
4
|
+
data.tar.gz: 3939cf81a472b76d4084d6236a39242d7a693e9f2434df576ac73bb153e8c5d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e868fd7037ffbecfda2be3103486940210bae975619d51d9c9f68521c0a9d7ea36bf7ebbea7ae5da8c90e19158fc11bbe82762b65c00d216d03d1342eb78d2a
|
|
7
|
+
data.tar.gz: f664f98a97054be9f2f9ddc89611f2fb68028b641eb47057534633dec2291939f770a792bc0b0506d7ce2297f0c5648e36d885315490810b338fe6dee1c6ca34
|
data/lib/reputable/connection.rb
CHANGED
|
@@ -80,10 +80,13 @@ module Reputable
|
|
|
80
80
|
def circuit_open?
|
|
81
81
|
return false unless @circuit_open
|
|
82
82
|
|
|
83
|
-
# Check if enough time has passed to try again
|
|
83
|
+
# Check if enough time has passed to try again (half-open state)
|
|
84
84
|
if @circuit_opened_at && (Time.now - @circuit_opened_at) > CIRCUIT_TIMEOUT
|
|
85
|
+
# Enter half-open state: allow one probe request through.
|
|
86
|
+
# Set failure_count to threshold - 1 so a single failure immediately
|
|
87
|
+
# re-opens the circuit instead of requiring another 5 failures.
|
|
85
88
|
@circuit_open = false
|
|
86
|
-
@failure_count =
|
|
89
|
+
@failure_count = CIRCUIT_THRESHOLD - 1
|
|
87
90
|
Reputable.logger&.info("Reputable circuit breaker: attempting reconnection")
|
|
88
91
|
return false
|
|
89
92
|
end
|
data/lib/reputable/version.rb
CHANGED