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

Unified Diff: tokenserver/appengine/impl/utils/bqlog/bqlog.go

Issue 2951393002: [errors] de-specialize Transient in favor of Tags. (Closed)
Patch Set: more refactor Created 3 years, 6 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
Index: tokenserver/appengine/impl/utils/bqlog/bqlog.go
diff --git a/tokenserver/appengine/impl/utils/bqlog/bqlog.go b/tokenserver/appengine/impl/utils/bqlog/bqlog.go
index 0892b52db9378ec0e3bb71fb038a717767da0c85..ae804a90c09aeb92c6cec340f27310d55ed2419e 100644
--- a/tokenserver/appengine/impl/utils/bqlog/bqlog.go
+++ b/tokenserver/appengine/impl/utils/bqlog/bqlog.go
@@ -44,6 +44,7 @@ import (
"github.com/luci/luci-go/common/errors"
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/retry"
+ "github.com/luci/luci-go/common/retry/transient"
"github.com/luci/luci-go/common/tsmon/distribution"
"github.com/luci/luci-go/common/tsmon/field"
@@ -558,7 +559,7 @@ func (f *asyncFlusher) upload(ctx context.Context, chunk chunk) (int, error) {
// Now actually send all the entries with retries.
var lastResp *bigquery.TableDataInsertAllResponse
taggedCtx := clock.Tag(ctx, "insert-retry") // used by tests
- err := retry.Retry(taggedCtx, retry.TransientOnly(f.retryParams), func() error {
+ err := retry.Retry(taggedCtx, transient.Only(f.retryParams), func() error {
startTime := clock.Now(ctx)
var err error
lastResp, err = f.Insert(ctx, &bigquery.TableDataInsertAllRequest{
@@ -578,7 +579,7 @@ func (f *asyncFlusher) upload(ctx context.Context, chunk chunk) (int, error) {
dt := clock.Since(ctx, startTime)
bigQueryLatency.Add(ctx, float64(dt.Nanoseconds()/1e6), f.TableRef, "insertAll", status)
if code >= 500 {
- return errors.WrapTransient(err)
+ return transient.Tag.Apply(err)
}
return err
}, func(err error, wait time.Duration) {
@@ -589,7 +590,7 @@ func (f *asyncFlusher) upload(ctx context.Context, chunk chunk) (int, error) {
})
if err != nil {
logging.WithError(err).Errorf(ctx, "Failed to send data to BigQuery")
- if !errors.IsTransient(err) && err != context.DeadlineExceeded {
+ if !transient.Tag.In(err) && err != context.DeadlineExceeded {
chunk.Done(ctx)
}
return 0, err

Powered by Google App Engine
This is Rietveld 408576698