Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: perf/go/alerting/alerting.go

Issue 777413002: Add new tests to presubmit, fix errors (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « perf/go/activitylog/activitylog.go ('k') | perf/go/filetilestore/filestore.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package alerting 1 package alerting
2 2
3 import ( 3 import (
4 "database/sql" 4 "database/sql"
5 "encoding/json" 5 "encoding/json"
6 "fmt" 6 "fmt"
7 "math" 7 "math"
8 "net/http" 8 "net/http"
9 "strconv" 9 "strconv"
10 "time" 10 "time"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 ret := []*types.ClusterSummary{} 128 ret := []*types.ClusterSummary{}
129 129
130 for rows.Next() { 130 for rows.Next() {
131 var body string 131 var body string
132 var id int64 132 var id int64
133 if err := rows.Scan(&id, &body); err != nil { 133 if err := rows.Scan(&id, &body); err != nil {
134 return nil, fmt.Errorf("Failed to read row from database : %s", err) 134 return nil, fmt.Errorf("Failed to read row from database : %s", err)
135 } 135 }
136 c := &types.ClusterSummary{} 136 c := &types.ClusterSummary{}
137 if err := json.Unmarshal([]byte(body), c); err != nil { 137 if err := json.Unmarshal([]byte(body), c); err != nil {
138 » » » glog.Errorf("Found invalid JSON in clusters table: %s %s ", id, err) 138 » » » glog.Errorf("Found invalid JSON in clusters table: %d %s ", id, err)
139 return nil, fmt.Errorf("Failed to read row from database : %s", err) 139 return nil, fmt.Errorf("Failed to read row from database : %s", err)
140 } 140 }
141 c.ID = id 141 c.ID = id
142 glog.Infof("ID: %d", id) 142 glog.Infof("ID: %d", id)
143 ret = append(ret, c) 143 ret = append(ret, c)
144 } 144 }
145 145
146 return ret, nil 146 return ret, nil
147 } 147 }
148 148
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 373
374 // Start kicks off a go routine the periodically refreshes the current alerting clusters. 374 // Start kicks off a go routine the periodically refreshes the current alerting clusters.
375 func Start(tileStore types.TileStore, apiKeyFlag string) { 375 func Start(tileStore types.TileStore, apiKeyFlag string) {
376 apiKey := apiKeyFromFlag(apiKeyFlag) 376 apiKey := apiKeyFromFlag(apiKeyFlag)
377 go func() { 377 go func() {
378 for _ = range time.Tick(config.RECLUSTER_DURATION) { 378 for _ = range time.Tick(config.RECLUSTER_DURATION) {
379 singleStep(tileStore, apiKey) 379 singleStep(tileStore, apiKey)
380 } 380 }
381 }() 381 }()
382 } 382 }
OLDNEW
« no previous file with comments | « perf/go/activitylog/activitylog.go ('k') | perf/go/filetilestore/filestore.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698