Skip to content

Commit d77790a

Browse files
committed
fix ci
1 parent 9262c31 commit d77790a

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

core/hotspot/rule.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package hotspot
1616

1717
import (
18-
"encoding/json"
1918
"fmt"
2019
"reflect"
2120
"strconv"
@@ -101,14 +100,11 @@ type Rule struct {
101100
}
102101

103102
func (r *Rule) String() string {
104-
b, err := json.Marshal(r)
105-
if err != nil {
106-
// Return the fallback string
107-
return fmt.Sprintf("{Id:%s, Resource:%s, MetricType:%+v, ControlBehavior:%+v, ParamIndex:%d, ParamKey:%s, Threshold:%d, MaxQueueingTimeMs:%d, BurstCount:%d, DurationInSec:%d, ParamsMaxCapacity:%d, SpecificItems:%+v}",
108-
r.ID, r.Resource, r.MetricType, r.ControlBehavior, r.ParamIndex, r.ParamKey, r.Threshold, r.MaxQueueingTimeMs, r.BurstCount, r.DurationInSec, r.ParamsMaxCapacity, r.SpecificItems)
109-
}
110-
return string(b)
103+
// Return the fallback string
104+
return fmt.Sprintf("{Id:%s, Resource:%s, MetricType:%+v, ControlBehavior:%+v, ParamIndex:%d, ParamKey:%s, Threshold:%d, MaxQueueingTimeMs:%d, BurstCount:%d, DurationInSec:%d, ParamsMaxCapacity:%d, SpecificItems:%+v}",
105+
r.ID, r.Resource, r.MetricType, r.ControlBehavior, r.ParamIndex, r.ParamKey, r.Threshold, r.MaxQueueingTimeMs, r.BurstCount, r.DurationInSec, r.ParamsMaxCapacity, r.SpecificItems)
111106
}
107+
112108
func (r *Rule) ResourceName() string {
113109
return r.Resource
114110
}

core/hotspot/rule_manager.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ func getTrafficControllersFor(res string) []TrafficShapingController {
8383

8484
// LoadRules replaces all old hotspot param flow rules with the given rules.
8585
// Return value:
86-
// bool: indicates whether the internal map has been changed;
87-
// error: indicates whether occurs the error.
86+
//
87+
// bool: indicates whether the internal map has been changed;
88+
// error: indicates whether occurs the error.
8889
func LoadRules(rules []*Rule) (bool, error) {
8990
resRulesMap := make(map[string][]*Rule, 16)
9091
for _, rule := range rules {
@@ -110,7 +111,7 @@ func LoadRules(rules []*Rule) (bool, error) {
110111
// GetRules returns all the hotspot param flow rules based on copy.
111112
// It doesn't take effect for hotspot module if user changes the returned rules.
112113
// GetRules need to compete hotspot module's global lock and the high performance losses of copy,
113-
// reduce or do not call GetRules if possible.
114+
// reduce or do not call GetRules if possible.
114115
func GetRules() []Rule {
115116
tcMux.RLock()
116117
rules := rulesFrom(tcMap)
@@ -126,7 +127,8 @@ func GetRules() []Rule {
126127
// GetRulesOfResource returns specific resource's hotspot parameter flow control rules based on copy.
127128
// It doesn't take effect for hotspot module if user changes the returned rules.
128129
// GetRulesOfResource need to compete hotspot module's global lock and the high performance losses of copy,
129-
// reduce or do not call GetRulesOfResource frequently if possible.
130+
//
131+
// reduce or do not call GetRulesOfResource frequently if possible.
130132
func GetRulesOfResource(res string) []Rule {
131133
tcMux.RLock()
132134
resTcs := tcMap[res]

core/stat/base/leap_array.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ func (aa *AtomicBucketWrapArray) compareAndSet(idx int, except, update *BucketWr
145145
// Suppose current timestamp is 1188, bucketLength is 200ms, intervalInMs is 1000ms, then
146146
// time span of current bucket is [1000, 1200). The representation of the underlying structure:
147147
//
148-
// B0 B1 B2 B3 B4
149-
// |_______|_______|_______|_______|_______|
150-
// 1000 1200 400 600 800 (1000) ms
151-
// ^
152-
// time=1188
148+
// B0 B1 B2 B3 B4
149+
// |_______|_______|_______|_______|_______|
150+
// 1000 1200 400 600 800 (1000) ms
151+
// ^
152+
// time=1188
153153
type LeapArray struct {
154154
bucketLengthInMs uint32
155155
// sampleCount represents the number of BucketWrap.

util/time_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/stretchr/testify/assert"
2323
)
2424

25-
//Time zone should be considered for time related operations
25+
// Time zone should be considered for time related operations
2626
func TestFormatTimeMillis(t *testing.T) {
2727
type args struct {
2828
ts uint64

0 commit comments

Comments
 (0)