We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent babb122 commit 33e645eCopy full SHA for 33e645e
core/hotspot/rule_manager.go
@@ -277,7 +277,7 @@ func IsValidRule(rule *Rule) error {
277
if rule.ParamIndex < 0 {
278
return errors.New("invalid param index")
279
}
280
- if rule.DurationInSec < 0 {
+ if rule.MetricType == QPS && rule.DurationInSec <= 0 {
281
return errors.New("invalid duration")
282
283
return checkControlBehaviorField(rule)
core/hotspot/traffic_shaping.go
@@ -53,6 +53,8 @@ func newBaseTrafficShapingController(r *Rule) *baseTrafficShapingController {
53
size := 0
54
if r.ParamsMaxCapacity > 0 {
55
size = int(r.ParamsMaxCapacity)
56
+ } else if r.DurationInSec == 0 {
57
+ size = ParamsMaxCapacity
58
} else {
59
size = int(math.Min(float64(ParamsMaxCapacity), float64(ParamsCapacityBase*r.DurationInSec)))
60
0 commit comments