@@ -61,7 +61,7 @@ type Rule struct {
6161 // that can trigger circuit breaking.
6262 MinRequestAmount uint64 `json:"minRequestAmount"`
6363 // StatIntervalMs represents statistic time interval of the internal circuit breaker (in ms).
64- // Currently the statistic interval is collected by sliding window.
64+ // Currently, the statistic interval is collected by sliding window.
6565 StatIntervalMs uint32 `json:"statIntervalMs"`
6666 // StatSlidingWindowBucketCount represents the bucket count of statistic sliding window.
6767 // The statistic will be more precise as the bucket count increases, but the memory cost increases too.
@@ -78,10 +78,10 @@ type Rule struct {
7878 // for ErrorRatio, it represents the max error request ratio
7979 // for ErrorCount, it represents the max error request count
8080 Threshold float64 `json:"threshold"`
81- //ProbeNum is number of probes required when the circuit breaker is half-open.
82- //when the probe num are set and circuit breaker in the half-open state.
83- //if err occurs during the probe, the circuit breaker is opened immediately.
84- //otherwise,the circuit breaker is closed only after the number of probes is reached
81+ // ProbeNum is number of probes required when the circuit breaker is half-open.
82+ // when the probe num are set and circuit breaker in the half-open state.
83+ // if err occurs during the probe, the circuit breaker is opened immediately.
84+ // otherwise,the circuit breaker is closed only after the number of probes is reached
8585 ProbeNum uint64 `json:"probeNum"`
8686}
8787
@@ -103,12 +103,14 @@ func (r *Rule) ResourceName() string {
103103 return r .Resource
104104}
105105
106+ // Check whether the fields shared by all rule strategy types are consistent
106107func (r * Rule ) isEqualsToBase (newRule * Rule ) bool {
107108 if newRule == nil {
108109 return false
109110 }
110111 return r .Resource == newRule .Resource && r .Strategy == newRule .Strategy && r .RetryTimeoutMs == newRule .RetryTimeoutMs &&
111- r .MinRequestAmount == newRule .MinRequestAmount && r .StatIntervalMs == newRule .StatIntervalMs && r .StatSlidingWindowBucketCount == newRule .StatSlidingWindowBucketCount
112+ r .MinRequestAmount == newRule .MinRequestAmount && r .StatIntervalMs == newRule .StatIntervalMs && r .StatSlidingWindowBucketCount == newRule .StatSlidingWindowBucketCount &&
113+ r .ProbeNum == newRule .ProbeNum
112114}
113115
114116func (r * Rule ) isEqualsTo (newRule * Rule ) bool {
0 commit comments