Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 // that can be found in the LICENSE file. | |
| 4 | |
| 5 package buildbot | |
| 6 | |
| 7 import ( | |
| 8 ds "github.com/luci/gae/service/datastore" | |
| 9 | |
| 10 "golang.org/x/net/context" | |
| 11 ) | |
| 12 | |
| 13 // buildQueryBatchSize is the batch size to use when querying build. It is | |
| 14 // employed as an upper bound by getBuildQueryBatcher. | |
| 15 // | |
| 16 // This should be tuned to the observed query timeout for build loading. Since | |
| 17 // loading is CPU-bound, this will probably be low. If build queries start | |
| 18 // encountering datastore timeouts, reduce this value. | |
| 19 const buildQueryBatchSize = 50 | |
| 20 | |
| 21 // getBuildQueryBatcher returns a ds.Batcher tuned for executing queries on the | |
| 22 // "buildbotBuild" entity. | |
| 23 func getBuildQueryBatcher(c context.Context) *ds.Batcher { | |
|
hinoka
2017/01/31 19:05:32
Would it make more sense to put this in the ds dat
dnj
2017/01/31 19:19:39
In the "ds" module, as in "luci/gae"? Batcher is a
| |
| 24 constraints := ds.Raw(c).Constraints() | |
| 25 if constraints.QueryBatchSize > buildQueryBatchSize { | |
| 26 constraints.QueryBatchSize = buildQueryBatchSize | |
| 27 } | |
| 28 return &ds.Batcher{ | |
| 29 Size: constraints.QueryBatchSize, | |
| 30 } | |
| 31 } | |
| OLD | NEW |