Code polishing

This commit is contained in:
chenjiandongx 2020-04-06 21:04:02 +08:00
parent 1c066df6ac
commit 03540ac19a
7 changed files with 3 additions and 7 deletions

View File

@ -83,7 +83,7 @@ func (cp *ConnPools) Update(cluster []string) {
cp.M[address] = createOnePool(address, address, ct, maxConns, maxIdle)
}
for address, _ := range cp.M {
for address := range cp.M {
if _, exists := newCluster[address]; !exists {
delete(cp.M, address)
}

View File

@ -178,7 +178,6 @@ func fetchDataSync(start, end int64, consolFun, endpoint, counter string, step i
stats.Counter.Set("query.data.err", 1)
}
dataChan <- data
return
}
func fetchData(start, end int64, consolFun, endpoint, counter string, step int) (*dataobj.TsdbQueryResponse, error) {

View File

@ -22,7 +22,6 @@ func (this *ConsistentHashRing) Set(r *consistent.Consistent) {
this.Lock()
defer this.Unlock()
this.ring = r
return
}
func (this *ConsistentHashRing) GetRing() *consistent.Consistent {

View File

@ -46,7 +46,7 @@ var (
)
func NewClusterNode(addrs []string) *backend.ClusterNode {
return &backend.ClusterNode{addrs}
return &backend.ClusterNode{Addrs: addrs}
}
// map["node"]="host1,host2" --> map["node"]=["host1", "host2"]

View File

@ -73,7 +73,7 @@ func getStrategy() {
//var metric string
if len(stra.Exprs) < 1 {
logger.Warning("stra:%v exprs illegal", stra)
logger.Warningf("stra:%v exprs illegal", stra)
continue
}
if stra.Exprs[0].Func == "nodata" {

View File

@ -52,5 +52,4 @@ func PushData(c *gin.Context) {
}
render.Data(c, "ok", nil)
return
}

View File

@ -76,5 +76,4 @@ func push(items []*dataobj.MetricValue) {
}
defer resp.Body.Close()
return
}