sentinel-golang
sentinel-golang copied to clipboard
Rule Manager: Improve CircuitBreaker rule loading API (#236)
Describe what this PR does / why we need it
PR per issue #236
Does this pull request fix one issue?
Add fixes to solve issue #236
Describe how you did it
Add logic to check for existing rule changes in this API and return as the first value Put recover method in one place so that all panics can be caught and assigned to the second value Failed rules will be returned to caller as the third value Add duplicate rule checker so that all loaded rules will be unique
Describe how to verify it
Added more UT cases to verify it
Special notes for reviews
Also Add CB Strategy Enumeration upper boundary. Modify API signature
Could you please fix CI?
Codecov Report
Merging #257 into master will increase coverage by
0.66%
. The diff coverage is86.95%
.
@@ Coverage Diff @@
## master #257 +/- ##
==========================================
+ Coverage 43.06% 43.73% +0.66%
==========================================
Files 79 79
Lines 3994 4020 +26
==========================================
+ Hits 1720 1758 +38
+ Misses 2009 2003 -6
+ Partials 265 259 -6
Impacted Files | Coverage Δ | |
---|---|---|
core/circuitbreaker/rule_manager.go | 54.00% <86.04%> (+12.62%) |
:arrow_up: |
core/circuitbreaker/rule.go | 36.66% <100.00%> (+6.66%) |
:arrow_up: |
ext/datasource/helper.go | 55.78% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 4e8f5a0...f2ae09e. Read the comment docs.
Thanks @louyuting for your update. I did only send out changes on CircuitBreaker module since there are multiple changes to Flow module in the latest branch. Would love to discuss and help on other modules. Please let me know if any concerns on current implementation.
Thanks @louyuting for your update. I did only send out changes on CircuitBreaker module since there are multiple changes to Flow module in the latest branch. Would love to discuss and help on other modules. Please let me know if any concerns on current implementation.
That's great. I will review this PR. Because of holiday, the response might be later.