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

Unified Diff: common/gcloud/gs/writer.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: common/gcloud/gs/writer.go
diff --git a/common/gcloud/gs/writer.go b/common/gcloud/gs/writer.go
index cb3b6ef43499cfce8926eabfde273ca98b1a8cb8..16c31850afb806a60a2839180b9e190b2395b0f5 100644
--- a/common/gcloud/gs/writer.go
+++ b/common/gcloud/gs/writer.go
@@ -9,9 +9,9 @@ import (
"time"
gs "cloud.google.com/go/storage"
- "github.com/luci/luci-go/common/errors"
log "github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/retry"
+ "github.com/luci/luci-go/common/retry/transient"
"golang.org/x/net/context"
)
@@ -42,11 +42,11 @@ func (w *prodWriter) Write(d []byte) (a int, err error) {
w.Writer = w.client.baseClient.Bucket(w.bucket).Object(w.relpath).NewWriter(w)
}
- err = retry.Retry(w, retry.TransientOnly(retry.Default), func() (ierr error) {
+ err = retry.Retry(w, transient.Only(retry.Default), func() (ierr error) {
a, ierr = w.Writer.Write(d)
// Assume all Write errors are transient.
- ierr = errors.WrapTransient(ierr)
+ ierr = transient.Tag.Apply(ierr)
return
}, func(err error, d time.Duration) {
log.Fields{
@@ -66,7 +66,7 @@ func (w *prodWriter) Close() error {
return nil
}
- return retry.Retry(w, retry.TransientOnly(retry.Default),
+ return retry.Retry(w, transient.Only(retry.Default),
w.Writer.Close,
func(err error, d time.Duration) {
log.Fields{

Powered by Google App Engine
This is Rietveld 408576698