@@ -61,7 +61,7 @@ type Rule struct {
61
61
// that can trigger circuit breaking.
62
62
MinRequestAmount uint64 `json:"minRequestAmount"`
63
63
// 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.
65
65
StatIntervalMs uint32 `json:"statIntervalMs"`
66
66
// StatSlidingWindowBucketCount represents the bucket count of statistic sliding window.
67
67
// The statistic will be more precise as the bucket count increases, but the memory cost increases too.
@@ -78,10 +78,10 @@ type Rule struct {
78
78
// for ErrorRatio, it represents the max error request ratio
79
79
// for ErrorCount, it represents the max error request count
80
80
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
85
85
ProbeNum uint64 `json:"probeNum"`
86
86
}
87
87
@@ -103,12 +103,14 @@ func (r *Rule) ResourceName() string {
103
103
return r .Resource
104
104
}
105
105
106
+ // Check whether the fields shared by all rule strategy types are consistent
106
107
func (r * Rule ) isEqualsToBase (newRule * Rule ) bool {
107
108
if newRule == nil {
108
109
return false
109
110
}
110
111
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
112
114
}
113
115
114
116
func (r * Rule ) isEqualsTo (newRule * Rule ) bool {
0 commit comments