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

Side by Side Diff: milo/appengine/buildbucket/builder.go

Issue 2801463002: Milo: Use custom config caching layer (Closed)
Patch Set: Review: Remove double logging Created 3 years, 8 months 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 | « milo/appengine/buildbucket/buckets.go ('k') | milo/appengine/buildbucket/builder_test.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 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package buildbucket 5 package buildbucket
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "fmt" 9 "fmt"
10 "net/url" 10 "net/url"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 type builderQuery struct { 223 type builderQuery struct {
224 Bucket string 224 Bucket string
225 Builder string 225 Builder string
226 Limit int 226 Limit int
227 } 227 }
228 228
229 // builderImpl is the implementation for getting a milo builder page from buildb ucket. 229 // builderImpl is the implementation for getting a milo builder page from buildb ucket.
230 // if maxCompletedBuilds < 0, 25 is used. 230 // if maxCompletedBuilds < 0, 25 is used.
231 func builderImpl(c context.Context, q builderQuery) (*resp.Builder, error) { 231 func builderImpl(c context.Context, q builderQuery) (*resp.Builder, error) {
232 » settings, err := common.GetSettings(c) 232 » settings := common.GetSettings(c)
233 » if err != nil {
234 » » logging.WithError(err).Errorf(c, "failed to get settings")
235 » » return nil, err
236 » }
237 if settings.Buildbucket == nil || settings.Buildbucket.Host == "" { 233 if settings.Buildbucket == nil || settings.Buildbucket.Host == "" {
238 » » logging.WithError(err).Errorf(c, "missing buildbucket settings") 234 » » logging.Errorf(c, "missing buildbucket settings")
239 return nil, errors.New("missing buildbucket settings") 235 return nil, errors.New("missing buildbucket settings")
240 } 236 }
241 host := settings.Buildbucket.Host 237 host := settings.Buildbucket.Host
242 238
243 if q.Limit < 0 { 239 if q.Limit < 0 {
244 q.Limit = 20 240 q.Limit = 20
245 } 241 }
246 242
247 result := &resp.Builder{ 243 result := &resp.Builder{
248 Name: q.Builder, 244 Name: q.Builder,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return time.Unix(microseconds/1e6, microseconds%1e6*1000).UTC() 287 return time.Unix(microseconds/1e6, microseconds%1e6*1000).UTC()
292 } 288 }
293 289
294 type newBuildsFirst []*resp.BuildSummary 290 type newBuildsFirst []*resp.BuildSummary
295 291
296 func (a newBuildsFirst) Len() int { return len(a) } 292 func (a newBuildsFirst) Len() int { return len(a) }
297 func (a newBuildsFirst) Swap(i, j int) { a[i], a[j] = a[j], a[i] } 293 func (a newBuildsFirst) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
298 func (a newBuildsFirst) Less(i, j int) bool { 294 func (a newBuildsFirst) Less(i, j int) bool {
299 return a[i].PendingTime.Started.After(a[j].PendingTime.Started) 295 return a[i].PendingTime.Started.After(a[j].PendingTime.Started)
300 } 296 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbucket/buckets.go ('k') | milo/appengine/buildbucket/builder_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698