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

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

Issue 2668763002: Use a datastore batcher for build queries. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | milo/appengine/buildbot/console.go » ('j') | milo/appengine/buildbot/datastore.go » ('J')
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 buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net/http" 9 "net/http"
10 "sort" 10 "sort"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 result := []*resp.BuildSummary{} 60 result := []*resp.BuildSummary{}
61 q := ds.NewQuery("buildbotBuild") 61 q := ds.NewQuery("buildbotBuild")
62 q = q.Eq("finished", finished) 62 q = q.Eq("finished", finished)
63 q = q.Eq("master", masterName) 63 q = q.Eq("master", masterName)
64 q = q.Eq("builder", builderName) 64 q = q.Eq("builder", builderName)
65 if limit != 0 { 65 if limit != 0 {
66 q = q.Limit(int32(limit)) 66 q = q.Limit(int32(limit))
67 } 67 }
68 q = q.Order("-number") 68 q = q.Order("-number")
69 buildbots := []*buildbotBuild{} 69 buildbots := []*buildbotBuild{}
70 » err := ds.GetAll(c, q, &buildbots) 70 » err := getBuildQueryBatcher(c).GetAll(c, q, &buildbots)
71 if err != nil { 71 if err != nil {
72 return nil, err 72 return nil, err
73 } 73 }
74 for _, b := range buildbots { 74 for _, b := range buildbots {
75 result = append(result, getBuildSummary(b)) 75 result = append(result, getBuildSummary(b))
76 } 76 }
77 return result, nil 77 return result, nil
78 } 78 }
79 79
80 var errMasterNotFound = miloerror.Error{ 80 var errMasterNotFound = miloerror.Error{
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 result.CurrentBuilds = currentBuilds 156 result.CurrentBuilds = currentBuilds
157 157
158 for _, fb := range finishedBuilds { 158 for _, fb := range finishedBuilds {
159 if fb != nil { 159 if fb != nil {
160 result.FinishedBuilds = append(result.FinishedBuilds, fb ) 160 result.FinishedBuilds = append(result.FinishedBuilds, fb )
161 } 161 }
162 } 162 }
163 return result, nil 163 return result, nil
164 } 164 }
OLDNEW
« no previous file with comments | « no previous file | milo/appengine/buildbot/console.go » ('j') | milo/appengine/buildbot/datastore.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698