Remove unnessary zero length
This commit is contained in:
parent
c1f38e5ca4
commit
db0ab16315
|
@ -57,7 +57,7 @@ func (r *Reader) StartRead() {
|
||||||
var readCnt, readSwp int64
|
var readCnt, readSwp int64
|
||||||
var dropCnt, dropSwp int64
|
var dropCnt, dropSwp int64
|
||||||
|
|
||||||
analysClose := make(chan int, 0)
|
analysClose := make(chan int)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
// 十秒钟统计一次
|
// 十秒钟统计一次
|
||||||
|
|
|
@ -14,7 +14,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
globalStrategy = make(map[int64]*stra.Strategy, 0)
|
globalStrategy = make(map[int64]*stra.Strategy)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Update() error {
|
func Update() error {
|
||||||
|
@ -22,7 +22,7 @@ func Update() error {
|
||||||
|
|
||||||
err := UpdateGlobalStrategy(strategies)
|
err := UpdateGlobalStrategy(strategies)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("Update Strategy cache error ! [msg:%v]", err)
|
logger.Errorf("Update Strategy cache error:%v\n", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger.Infof("Update Strategy end")
|
logger.Infof("Update Strategy end")
|
||||||
|
@ -30,7 +30,7 @@ func Update() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateGlobalStrategy(sts []*stra.Strategy) error {
|
func UpdateGlobalStrategy(sts []*stra.Strategy) error {
|
||||||
tmpStrategyMap := make(map[int64]*stra.Strategy, 0)
|
tmpStrategyMap := make(map[int64]*stra.Strategy)
|
||||||
for _, st := range sts {
|
for _, st := range sts {
|
||||||
if st.Degree == 0 {
|
if st.Degree == 0 {
|
||||||
st.Degree = 6
|
st.Degree = 6
|
||||||
|
|
|
@ -25,7 +25,7 @@ type pushPointsCache struct {
|
||||||
Counters map[string]*counterCache `json:"counters"`
|
Counters map[string]*counterCache `json:"counters"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var globalPushPoints = pushPointsCache{Counters: make(map[string]*counterCache, 0)}
|
var globalPushPoints = pushPointsCache{Counters: make(map[string]*counterCache)}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
go CleanLoop()
|
go CleanLoop()
|
||||||
|
|
|
@ -253,7 +253,7 @@ func (sc *StrategyCounter) AddTms(tms int64) error {
|
||||||
_, ok := sc.TmsPoints[tms]
|
_, ok := sc.TmsPoints[tms]
|
||||||
if !ok {
|
if !ok {
|
||||||
tmp := new(PointsCounter)
|
tmp := new(PointsCounter)
|
||||||
tmp.TagstringMap = make(map[string]*PointCounter, 0)
|
tmp.TagstringMap = make(map[string]*PointCounter)
|
||||||
sc.TmsPoints[tms] = tmp
|
sc.TmsPoints[tms] = tmp
|
||||||
}
|
}
|
||||||
sc.Unlock()
|
sc.Unlock()
|
||||||
|
@ -300,7 +300,7 @@ func (gc *GlobalCounter) AddStrategyCount(st *stra.Strategy) {
|
||||||
if _, ok := gc.StrategyCounts[st.ID]; !ok {
|
if _, ok := gc.StrategyCounts[st.ID]; !ok {
|
||||||
tmp := new(StrategyCounter)
|
tmp := new(StrategyCounter)
|
||||||
tmp.Strategy = st
|
tmp.Strategy = st
|
||||||
tmp.TmsPoints = make(map[int64]*PointsCounter, 0)
|
tmp.TmsPoints = make(map[int64]*PointsCounter)
|
||||||
gc.StrategyCounts[st.ID] = tmp
|
gc.StrategyCounts[st.ID] = tmp
|
||||||
}
|
}
|
||||||
gc.Unlock()
|
gc.Unlock()
|
||||||
|
@ -348,7 +348,7 @@ func (gc *GlobalCounter) cleanStrategyData(id int64) {
|
||||||
if !ok || sCount == nil {
|
if !ok || sCount == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sCount.TmsPoints = make(map[int64]*PointsCounter, 0)
|
sCount.TmsPoints = make(map[int64]*PointsCounter)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ func ToPushQueue(strategy *stra.Strategy, tms int64, pointMap map[string]*PointC
|
||||||
|
|
||||||
var tags map[string]string
|
var tags map[string]string
|
||||||
if tagstring == "null" {
|
if tagstring == "null" {
|
||||||
tags = make(map[string]string, 0)
|
tags = make(map[string]string)
|
||||||
} else {
|
} else {
|
||||||
tags = dataobj.DictedTagstring(tagstring)
|
tags = dataobj.DictedTagstring(tagstring)
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ func (w *Worker) Work() {
|
||||||
logger.Infof("worker starting...[%s]", w.Mark)
|
logger.Infof("worker starting...[%s]", w.Mark)
|
||||||
|
|
||||||
var anaCnt, anaSwp int64
|
var anaCnt, anaSwp int64
|
||||||
analysClose := make(chan int, 0)
|
analysClose := make(chan int)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
|
|
@ -165,7 +165,7 @@ func parsePattern(strategies []*Strategy) {
|
||||||
|
|
||||||
func updateRegs(strategies []*Strategy) {
|
func updateRegs(strategies []*Strategy) {
|
||||||
for _, st := range strategies {
|
for _, st := range strategies {
|
||||||
st.TagRegs = make(map[string]*regexp.Regexp, 0)
|
st.TagRegs = make(map[string]*regexp.Regexp)
|
||||||
st.ParseSucc = false
|
st.ParseSucc = false
|
||||||
|
|
||||||
//更新时间正则
|
//更新时间正则
|
||||||
|
|
Loading…
Reference in New Issue