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

Side by Side Diff: appengine/logdog/coordinator/backend/backend.go

Issue 1844963002: Iterate archive query alongside task queue. (Closed) Base URL: https://github.com/luci/luci-go@collector-gae-classic
Patch Set: Use new GAE filter for query batching. Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package backend 5 package backend
6 6
7 import ( 7 import (
8 "github.com/julienschmidt/httprouter" 8 "github.com/julienschmidt/httprouter"
9 "github.com/luci/luci-go/appengine/gaemiddleware" 9 "github.com/luci/luci-go/appengine/gaemiddleware"
10 "github.com/luci/luci-go/appengine/logdog/coordinator" 10 "github.com/luci/luci-go/appengine/logdog/coordinator"
11 "github.com/luci/luci-go/server/middleware" 11 "github.com/luci/luci-go/server/middleware"
12 ) 12 )
13 13
14 const (
15 // defaultMultiTaskBatchSize is the default value for Backend's
16 // multiTaskBatchSize parameter.
17 defaultMultiTaskBatchSize = 100
18 )
19
14 // Backend is the base struct for all Backend handlers. It is mostly used to 20 // Backend is the base struct for all Backend handlers. It is mostly used to
15 // configure testing parameters. 21 // configure testing parameters.
16 type Backend struct { 22 type Backend struct {
17 // multiTaskBatchSize is the number of batch tasks to create at a time. 23 // multiTaskBatchSize is the number of batch tasks to create at a time.
18 multiTaskBatchSize int 24 multiTaskBatchSize int
19 25
20 // s is the backing Coordinator service base. 26 // s is the backing Coordinator service base.
21 s coordinator.Service 27 s coordinator.Service
22 } 28 }
23 29
30 func (b *Backend) getMultiTaskBatchSize() int {
31 if v := b.multiTaskBatchSize; v > 0 {
32 return v
33 }
34 return defaultMultiTaskBatchSize
35 }
36
24 // InstallHandlers installs handlers for the Backend. 37 // InstallHandlers installs handlers for the Backend.
25 func (b *Backend) InstallHandlers(r *httprouter.Router, h middleware.Base) { 38 func (b *Backend) InstallHandlers(r *httprouter.Router, h middleware.Base) {
26 r.GET("/archive/cron/terminal", h(gaemiddleware.RequireCron(b.HandleArch iveCron))) 39 r.GET("/archive/cron/terminal", h(gaemiddleware.RequireCron(b.HandleArch iveCron)))
27 r.GET("/archive/cron/nonterminal", h(gaemiddleware.RequireCron(b.HandleA rchiveCronNT))) 40 r.GET("/archive/cron/nonterminal", h(gaemiddleware.RequireCron(b.HandleA rchiveCronNT)))
28 r.GET("/archive/cron/purge", h(b.HandleArchiveCronPurge)) 41 r.GET("/archive/cron/purge", h(b.HandleArchiveCronPurge))
29 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698