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

Unified Diff: logdog/client/butler/output/pubsub/pubsubOutput.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: logdog/client/butler/output/pubsub/pubsubOutput.go
diff --git a/logdog/client/butler/output/pubsub/pubsubOutput.go b/logdog/client/butler/output/pubsub/pubsubOutput.go
index 841c34b10f208a0e96f04fa8820789b42e1530e0..552e40e6cb637e2c5dab257ac4ddc70122e1a947 100644
--- a/logdog/client/butler/output/pubsub/pubsubOutput.go
+++ b/logdog/client/butler/output/pubsub/pubsubOutput.go
@@ -16,6 +16,7 @@ import (
gcps "github.com/luci/luci-go/common/gcloud/pubsub"
log "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/grpc/grpcutil"
"github.com/luci/luci-go/logdog/api/logpb"
"github.com/luci/luci-go/logdog/client/butler/output"
@@ -194,7 +195,7 @@ func (o *pubSubOutput) buildMessage(buf *buffer, bundle *logpb.ButlerLogBundle)
func (o *pubSubOutput) publishMessage(message *pubsub.Message) error {
var messageID string
transientErrors := 0
- err := retry.Retry(o, retry.TransientOnly(indefiniteRetry), func() (err error) {
+ err := retry.Retry(o, transient.Only(indefiniteRetry), func() (err error) {
ctx := o.Context
if o.RPCTimeout > 0 {
var cancelFunc context.CancelFunc
@@ -205,7 +206,7 @@ func (o *pubSubOutput) publishMessage(message *pubsub.Message) error {
messageID, err = o.Topic.Publish(ctx, message)
if err == context.DeadlineExceeded {
// If we hit our publish deadline, retry.
- err = errors.WrapTransient(err)
+ err = transient.Tag.Apply(err)
} else {
err = grpcutil.WrapIfTransient(err)
}

Powered by Google App Engine
This is Rietveld 408576698