From 064adb67c2d430dab423327bfb607ce0257417ab Mon Sep 17 00:00:00 2001 From: Edward Date: Fri, 22 May 2020 14:18:17 +0800 Subject: [PATCH] Update circuit-breaker.md --- stability/circuit-breaker.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/stability/circuit-breaker.md b/stability/circuit-breaker.md index 30f59cf..06eba0b 100644 --- a/stability/circuit-breaker.md +++ b/stability/circuit-breaker.md @@ -41,6 +41,12 @@ type Counter interface { LastActivity() time.Time Reset() } + +type counters struct { + ConsecutiveFailures uint32 + ConsecutiveSuccesses uint32 +} + ``` ### Circuit Breaker @@ -60,21 +66,6 @@ import ( "time" ) -type State int - -const ( - UnknownState State = iota - FailureState - SuccessState -) - -type Counter interface { - Count(State) - ConsecutiveFailures() uint32 - LastActivity() time.Time - Reset() -} - type Circuit func(context.Context) error var canRetry = func(cnt counters, failureThreshold uint32) bool {