Skip to content

Commit d022a91

Browse files
authored
Optimize code in core/circuitbreaker/rule.go (#417)
1 parent 0e9ae33 commit d022a91

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

core/circuitbreaker/rule.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,8 @@ func (r *Rule) isEqualsTo(newRule *Rule) bool {
126126
func getRuleStatSlidingWindowBucketCount(r *Rule) uint32 {
127127
interval := r.StatIntervalMs
128128
bucketCount := r.StatSlidingWindowBucketCount
129-
if bucketCount == 0 {
129+
if bucketCount == 0 || interval%bucketCount != 0 {
130130
bucketCount = 1
131-
} else {
132-
if interval%bucketCount != 0 {
133-
bucketCount = 1
134-
}
135131
}
136132
return bucketCount
137133
}

0 commit comments

Comments
 (0)