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

Side by Side Diff: tumble/service.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: more refactor Created 3 years, 5 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
« grpc/grpcutil/errors.go ('K') | « tumble/process.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 tumble 5 package tumble
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net/http" 9 "net/http"
10 "net/url" 10 "net/url"
11 "strconv" 11 "strconv"
12 "strings" 12 "strings"
13 "time" 13 "time"
14 14
15 "github.com/luci/luci-go/appengine/gaemiddleware" 15 "github.com/luci/luci-go/appengine/gaemiddleware"
16 "github.com/luci/luci-go/common/errors" 16 "github.com/luci/luci-go/common/errors"
17 "github.com/luci/luci-go/common/logging" 17 "github.com/luci/luci-go/common/logging"
18 "github.com/luci/luci-go/common/retry/transient"
18 "github.com/luci/luci-go/common/sync/parallel" 19 "github.com/luci/luci-go/common/sync/parallel"
19 "github.com/luci/luci-go/server/router" 20 "github.com/luci/luci-go/server/router"
20 21
21 ds "github.com/luci/gae/service/datastore" 22 ds "github.com/luci/gae/service/datastore"
22 "github.com/luci/gae/service/info" 23 "github.com/luci/gae/service/info"
23 24
24 "golang.org/x/net/context" 25 "golang.org/x/net/context"
25 ) 26 )
26 27
27 const ( 28 const (
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return 219 return
219 } 220 }
220 221
221 cfg := getConfig(c) 222 cfg := getConfig(c)
222 223
223 logging.Infof(c, "Processing tasks in namespace %q", info.GetNamespace(c )) 224 logging.Infof(c, "Processing tasks in namespace %q", info.GetNamespace(c ))
224 err = processShard(c, cfg, time.Unix(tstamp, 0).UTC(), sid, loop) 225 err = processShard(c, cfg, time.Unix(tstamp, 0).UTC(), sid, loop)
225 if err != nil { 226 if err != nil {
226 logging.Errorf(c, "failure! %s", err) 227 logging.Errorf(c, "failure! %s", err)
227 228
228 » » if errors.IsTransient(err) { 229 » » if transient.Tag.In(err) {
229 rw.Header().Add(transientHTTPHeader, "true") 230 rw.Header().Add(transientHTTPHeader, "true")
230 } 231 }
231 rw.WriteHeader(http.StatusInternalServerError) 232 rw.WriteHeader(http.StatusInternalServerError)
232 fmt.Fprintf(rw, "error: %s", err) 233 fmt.Fprintf(rw, "error: %s", err)
233 } else { 234 } else {
234 rw.Write([]byte("ok")) 235 rw.Write([]byte("ok"))
235 } 236 }
236 } 237 }
237 238
238 // getDatastoreNamespaces returns a list of all of the namespaces in the 239 // getDatastoreNamespaces returns a list of all of the namespaces in the
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 query.Set("ns", ns) 277 query.Set("ns", ns)
277 } 278 }
278 if !loop { 279 if !loop {
279 query.Set("single", "1") 280 query.Set("single", "1")
280 } 281 }
281 if len(query) > 0 { 282 if len(query) > 0 {
282 v += "?" + query.Encode() 283 v += "?" + query.Encode()
283 } 284 }
284 return v 285 return v
285 } 286 }
OLDNEW
« grpc/grpcutil/errors.go ('K') | « tumble/process.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698