Skip to content

Commit

Permalink
rm nil items in http.responses
Browse files Browse the repository at this point in the history
  • Loading branch information
niean committed Aug 27, 2015
1 parent 3add2d1 commit 12655f6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ _testmain.go
/var
/query

*.txt
/falcon-query*
/release

gitversion
cfg.json
g/git.go
cfg.json
3 changes: 2 additions & 1 deletion g/g.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
// 1.3.5 fill response with endpoint & counter when rpc Graph.Query getting errors
// 1.4.0 restruct query: use simple rpc conn pool
// 1.4.1 add last item counter, add proc for connpool
// 1.4.2 rm nil items in http.responses

const (
VERSION = "1.4.1"
VERSION = "1.4.2"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion g/git.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package g
const (
COMMIT = "923f80c"
COMMIT = "201f64c"
)
15 changes: 12 additions & 3 deletions http/graph_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ func configGraphRoutes() {
if err != nil {
log.Printf("graph.queryOne fail, %v", err)
}
if result == nil {
continue
}
data = append(data, result)
}

// statistics
proc.HistoryResponseCounterCnt.IncrBy(int64(len(data)))
for _, item := range data {
if item == nil {
continue
}
proc.HistoryResponseItemCnt.IncrBy(int64(len(item.Values)))
}

Expand Down Expand Up @@ -93,6 +93,9 @@ func configGraphRoutes() {
if err != nil {
log.Printf("graph.info fail, resp: %v, err: %v", info, err)
}
if info == nil {
continue
}
data = append(data, info)
}

Expand Down Expand Up @@ -126,6 +129,9 @@ func configGraphRoutes() {
if err != nil {
log.Printf("graph.last fail, resp: %v, err: %v", last, err)
}
if last == nil {
continue
}
data = append(data, last)
}

Expand Down Expand Up @@ -162,6 +168,9 @@ func configGraphRoutes() {
if err != nil {
log.Printf("graph.last.raw fail, resp: %v, err: %v", last, err)
}
if last == nil {
continue
}
data = append(data, last)
}
// statistics
Expand Down

0 comments on commit 12655f6

Please sign in to comment.