File tree 1 file changed +1
-23
lines changed
1 file changed +1
-23
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,8 @@ package flow
3
3
import (
4
4
"encoding/json"
5
5
"fmt"
6
- "github.com/pkg/errors"
7
6
"github.com/alibaba/sentinel-golang/logging"
8
- "github.com/alibaba/sentinel-golang/util "
7
+ "github.com/pkg/errors "
9
8
"sync"
10
9
)
11
10
24
23
tcGenFuncMap = make (map [ControlBehavior ]TrafficControllerGenFunc )
25
24
tcMap = make (TrafficControllerMap , 0 )
26
25
tcMux = new (sync.RWMutex )
27
-
28
- ruleChan = make (chan []* FlowRule , 10 )
29
- propertyInit sync.Once
30
26
)
31
27
32
28
func init () {
33
- propertyInit .Do (func () {
34
- initRuleRecvTask ()
35
- })
36
-
37
29
// Initialize the traffic shaping controller generator map for existing control behaviors.
38
30
tcGenFuncMap [Reject ] = func (rule * FlowRule ) * TrafficShapingController {
39
31
return NewTrafficShapingController (NewDefaultTrafficShapingCalculator (rule .Count ), NewDefaultTrafficShapingChecker (rule .MetricType ), rule )
@@ -43,20 +35,6 @@ func init() {
43
35
}
44
36
}
45
37
46
- func initRuleRecvTask () {
47
- go util .RunWithRecover (func () {
48
- for {
49
- select {
50
- case rules := <- ruleChan :
51
- err := onRuleUpdate (rules )
52
- if err != nil {
53
- logger .Errorf ("Failed to update flow rules: %+v" , err )
54
- }
55
- }
56
- }
57
- }, logger )
58
- }
59
-
60
38
func logRuleUpdate (m TrafficControllerMap ) {
61
39
bs , err := json .Marshal (rulesFrom (m ))
62
40
if err != nil {
You can’t perform that action at this time.
0 commit comments