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

Unified Diff: appengine/tsmon/handler.go

Issue 2617903005: Remove dsQueryBatch in favor of ds.Batcher. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/datastorecache/manager.go ('k') | appengine/tsmon/handler_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/tsmon/handler.go
diff --git a/appengine/tsmon/handler.go b/appengine/tsmon/handler.go
index b51ae2c0e6d9ddc69a628338626687ad57550c53..f56b3daee69a42fcd55d27be40d3dcca7a453509 100644
--- a/appengine/tsmon/handler.go
+++ b/appengine/tsmon/handler.go
@@ -9,7 +9,6 @@ import (
"golang.org/x/net/context"
- "github.com/luci/gae/filter/dsQueryBatch"
ds "github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/info"
@@ -19,8 +18,6 @@ import (
"github.com/luci/luci-go/server/router"
)
-const housekeepingInstanceBatchSize = 200
-
// InstallHandlers installs HTTP handlers for tsmon routes.
func InstallHandlers(r *router.Router, base router.MiddlewareChain) {
r.GET("/internal/cron/ts_mon/housekeeping", base, housekeepingHandler)
@@ -55,7 +52,7 @@ func assignTaskNumbers(c context.Context) error {
usedTaskNums := map[int]struct{}{}
totalExpired := 0
- expiredKeys := make([]*ds.Key, 0, housekeepingInstanceBatchSize)
+ expiredKeys := make([]*ds.Key, 0, ds.Raw(c).Constraints().QueryBatchSize)
var unassigned []*instance
// expireInstanceBatch processes the set of instances in "expiredKeys",
@@ -83,7 +80,11 @@ func assignTaskNumbers(c context.Context) error {
// Query all instances from datastore.
q := ds.NewQuery("Instance")
- if err := ds.Run(dsQueryBatch.BatchQueries(c, housekeepingInstanceBatchSize, expireInstanceBatch), q, func(i *instance) {
+
+ b := ds.Batcher{
+ Callback: expireInstanceBatch,
+ }
+ if err := b.Run(c, q, func(i *instance) {
if i.TaskNum >= 0 {
usedTaskNums[i.TaskNum] = struct{}{}
}
« no previous file with comments | « appengine/datastorecache/manager.go ('k') | appengine/tsmon/handler_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698