-
Notifications
You must be signed in to change notification settings - Fork 438
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
fix bug in circuit_breaker.go about SlowRequestRatio #315
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the same problem exists in errorRatioCircuitBreaker
Exactly. Thanks for your tip |
The Rule.Threshold means the max value that circuit breaker allowed. If the statistic ratio is great than Threshold, the circuit breaker will open. From my perspective, setting Rule.Threshold as 1.0 doesn't make sense. May be we should check (Threshold==1.0) in
|
|
@@ -290,7 +290,8 @@ func (b *slowRtCircuitBreaker) OnRequestComplete(rt uint64, err error) { | |||
return | |||
} | |||
|
|||
if slowRatio > b.maxSlowRequestRatio { | |||
// Special case when maxSlowRequestRatio is set to 1.0 should be handled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need to change checking logic.
Using "slowRatio >= b.maxSlowRequestRatio"、”errorRatio >= b.errorRatioThreshold“ and ”errorCount >= b.errorCountThreshold“
It's easier to understand.
Maybe we need improve the checking logic here. Refer to my comments |
Codecov Report
@@ Coverage Diff @@
## master #315 +/- ##
=======================================
Coverage 50.31% 50.31%
=======================================
Files 68 68
Lines 3705 3705
=======================================
Hits 1864 1864
Misses 1580 1580
Partials 261 261
Continue to review full report at Codecov.
|
Maybe you do a wrong update. Below is my comments:
|
Modified.Thanks for suggestions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work and looking forward more~
appreciated for your help |
Describe what this PR does / why we need it
when slowRequestRatio was set to 1.0d, requests will never be blocked. Because the currentRatio will never be bigger than 100%
Does this pull request fix one issue?
Describe how you did it
Special treatment for case when slowRequestRatio was set to 1.0d
Describe how to verify it
Special notes for reviews