Skip to content

Commit 23e24e4

Browse files
add check to clear errors on first success if
error_threshold_timeout_enabled false
1 parent 814dac7 commit 23e24e4

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lib/semian/circuit_breaker.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def mark_failed(error)
7777
end
7878

7979
def mark_success
80+
@errors.clear unless error_threshold_timeout_enabled
8081
return unless half_open?
8182

8283
@successes.increment

test/helpers/circuit_breaker_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def trigger_error!(resource = @resource, error = SomeError)
2222

2323
def assert_circuit_closed(resource = @resource)
2424
block_called = false
25+
2526
resource.acquire { block_called = true }
2627

2728
assert(block_called, "Expected the circuit to be closed, but it was open")

0 commit comments

Comments
 (0)