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

Side by Side Diff: milo/appengine/buildbot/pubsub.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
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 "bytes" 8 "bytes"
9 "compress/gzip" 9 "compress/gzip"
10 "compress/zlib" 10 "compress/zlib"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return 500 231 return 500
232 } 232 }
233 masterCounter.Add(c, 1, internal, fullname, "success") 233 masterCounter.Add(c, 1, internal, fullname, "success")
234 234
235 // Extract current builds data out of the master json, and use it to 235 // Extract current builds data out of the master json, and use it to
236 // clean up expired builds. 236 // clean up expired builds.
237 q := ds.NewQuery("buildbotBuild"). 237 q := ds.NewQuery("buildbotBuild").
238 Eq("finished", false). 238 Eq("finished", false).
239 Eq("master", master.Name) 239 Eq("master", master.Name)
240 builds := []*buildbotBuild{} 240 builds := []*buildbotBuild{}
241 » err = ds.GetAll(c, q, &builds) 241 » err = getBuildQueryBatcher(c).GetAll(c, q, &builds)
242 if err != nil { 242 if err != nil {
243 logging.WithError(err).Errorf(c, "Could not load current builds from master %s", 243 logging.WithError(err).Errorf(c, "Could not load current builds from master %s",
244 master.Name) 244 master.Name)
245 return 500 245 return 500
246 } 246 }
247 for _, b := range builds { 247 for _, b := range builds {
248 builder, ok := master.Builders[b.Buildername] 248 builder, ok := master.Builders[b.Buildername]
249 if !ok { 249 if !ok {
250 // Mark this build due to builder being removed. 250 // Mark this build due to builder being removed.
251 buildCounter.Add( 251 buildCounter.Add(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 } 398 }
399 if master != nil { 399 if master != nil {
400 code := doMaster(c, master, internal) 400 code := doMaster(c, master, internal)
401 if code != 0 { 401 if code != 0 {
402 return code 402 return code
403 } 403 }
404 } 404 }
405 return 200 405 return 200
406 } 406 }
OLDNEW
« milo/appengine/buildbot/datastore.go ('K') | « milo/appengine/buildbot/master.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698