Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[bug-fix] probeNum参数更新,loadRule生效" #585

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions core/circuitbreaker/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type Rule struct {
// that can trigger circuit breaking.
MinRequestAmount uint64 `json:"minRequestAmount"`
// StatIntervalMs represents statistic time interval of the internal circuit breaker (in ms).
// Currently, the statistic interval is collected by sliding window.
// Currently the statistic interval is collected by sliding window.
StatIntervalMs uint32 `json:"statIntervalMs"`
// StatSlidingWindowBucketCount represents the bucket count of statistic sliding window.
// The statistic will be more precise as the bucket count increases, but the memory cost increases too.
Expand All @@ -78,10 +78,10 @@ type Rule struct {
// for ErrorRatio, it represents the max error request ratio
// for ErrorCount, it represents the max error request count
Threshold float64 `json:"threshold"`
// ProbeNum is number of probes required when the circuit breaker is half-open.
// when the probe num are set and circuit breaker in the half-open state.
// if err occurs during the probe, the circuit breaker is opened immediately.
// otherwise,the circuit breaker is closed only after the number of probes is reached
//ProbeNum is number of probes required when the circuit breaker is half-open.
//when the probe num are set and circuit breaker in the half-open state.
//if err occurs during the probe, the circuit breaker is opened immediately.
//otherwise,the circuit breaker is closed only after the number of probes is reached
ProbeNum uint64 `json:"probeNum"`
}

Expand All @@ -103,14 +103,12 @@ func (r *Rule) ResourceName() string {
return r.Resource
}

// Check whether the fields shared by all rule strategy types are consistent
func (r *Rule) isEqualsToBase(newRule *Rule) bool {
if newRule == nil {
return false
}
return r.Resource == newRule.Resource && r.Strategy == newRule.Strategy && r.RetryTimeoutMs == newRule.RetryTimeoutMs &&
r.MinRequestAmount == newRule.MinRequestAmount && r.StatIntervalMs == newRule.StatIntervalMs && r.StatSlidingWindowBucketCount == newRule.StatSlidingWindowBucketCount &&
r.ProbeNum == newRule.ProbeNum
r.MinRequestAmount == newRule.MinRequestAmount && r.StatIntervalMs == newRule.StatIntervalMs && r.StatSlidingWindowBucketCount == newRule.StatSlidingWindowBucketCount
}

func (r *Rule) isEqualsTo(newRule *Rule) bool {
Expand Down
24 changes: 0 additions & 24 deletions core/circuitbreaker/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,30 +368,6 @@ func TestRuleIsEqualsToBase(t *testing.T) {
},
expectedResult: false,
},
// different ProbeNum
{
rule1: &Rule{
Resource: "abc",
Strategy: ErrorCount,
RetryTimeoutMs: 3000,
MinRequestAmount: 10,
StatIntervalMs: 10000,
StatSlidingWindowBucketCount: 2,
Threshold: 1.0,
ProbeNum: 10,
},
rule2: &Rule{
Resource: "abc",
Strategy: ErrorCount,
RetryTimeoutMs: 3000,
MinRequestAmount: 10,
StatIntervalMs: 10000,
StatSlidingWindowBucketCount: 2,
Threshold: 1.0,
ProbeNum: 11,
},
expectedResult: false,
},
}

for i, c := range cases {
Expand Down
2 changes: 1 addition & 1 deletion core/hotspot/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type Rule struct {
// ControlBehavior only takes effect when MetricType is QPS
ControlBehavior ControlBehavior `json:"controlBehavior"`
// ParamIndex is the index in context arguments slice.
// if ParamIndex is greater than or equals to zero, ParamIndex means the <ParamIndex>-th parameter
// if ParamIndex is great than or equals to zero, ParamIndex means the <ParamIndex>-th parameter
// if ParamIndex is the negative, ParamIndex means the reversed <ParamIndex>-th parameter
ParamIndex int `json:"paramIndex"`
// ParamKey is the key in EntryContext.Input.Attachments map.
Expand Down
Loading