-
Notifications
You must be signed in to change notification settings - Fork 78
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
small refactor circuitbreaker #1816
Conversation
Deploying with Cloudflare Pages
|
[CHATOPS:HELP] ChatOps commands.
|
7215b3c
to
33078b6
Compare
Codecov ReportBase: 50.23% // Head: 30.33% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1816 +/- ##
===========================================
- Coverage 50.23% 30.33% -19.91%
===========================================
Files 231 371 +140
Lines 13464 34033 +20569
===========================================
+ Hits 6764 10323 +3559
- Misses 6499 23288 +16789
- Partials 201 422 +221
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
94d2ea6
to
d6607ee
Compare
Signed-off-by: kpango <kpango@vdaas.org>
d6607ee
to
b0232ed
Compare
[FOSSA] The scan result will be available at https://app.fossa.com/projects/custom%2B21465%2Fvald/refs/branch/refactor%2Finternal%2Fcircuitbreaker/0d2ee27f768d10057357e3adf9bf22546f145092 |
Profile Report
|
if errors.As(err, &serr) { | ||
b.success() | ||
return nil, b.currentState(), serr.Unwrap() | ||
return nil, b.currentState(), err.(*errors.ErrCircuitBreakerMarkWithSuccess).Unwrap() |
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.
🚫 [golangci] reported by reviewdog 🐶
type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
if errors.As(err, &igerr) { | ||
return nil, b.currentState(), igerr.Unwrap() | ||
return nil, b.currentState(), err.(*errors.ErrCircuitBreakerIgnorable).Unwrap() |
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.
🚫 [golangci] reported by reviewdog 🐶
type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
if err != nil { | ||
return nil, err | ||
switch st { |
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.
🚫 [golangci] reported by reviewdog 🐶
missing cases in switch of type State: StateUnknown (exhaustive)
@@ -39,10 +39,15 @@ | |||
closedRefreshExp int64 // unix time | |||
} | |||
|
|||
var ( | |||
serr = new(errors.ErrCircuitBreakerMarkWithSuccess) |
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.
🚫 [golangci] reported by reviewdog 🐶
serr is a global variable (gochecknoglobals)
@@ -39,10 +39,15 @@ | |||
closedRefreshExp int64 // unix time | |||
} | |||
|
|||
var ( | |||
serr = new(errors.ErrCircuitBreakerMarkWithSuccess) | |||
igerr = new(errors.ErrCircuitBreakerIgnorable) |
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.
🚫 [golangci] reported by reviewdog 🐶
igerr is a global variable (gochecknoglobals)
@@ -72,20 +72,41 @@ | |||
mu.Unlock() | |||
}() | |||
|
|||
var br *breaker |
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.
🚫 [golangci] reported by reviewdog 🐶
variable name 'br' is too short for the scope of its usage (varnamelen)
Signed-off-by: kpango <kpango@vdaas.org>
ad7cd99
to
e14bb31
Compare
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.
LGTM
Signed-off-by: kpango kpango@vdaas.org
Description:
Related Issue:
How Has This Been Tested?:
Environment:
Types of changes:
Changes to Core Features:
Checklist: