| Index: common/retry/transient.go
|
| diff --git a/common/retry/transient.go b/common/retry/transient.go
|
| index fa641d446df9574cf752afbed012b4e1a08eb44a..6fbe3b37d6153bbd53fd1fffa58e2c8dc2f2c1c4 100644
|
| --- a/common/retry/transient.go
|
| +++ b/common/retry/transient.go
|
| @@ -12,15 +12,13 @@ import (
|
| )
|
|
|
| // transientOnlyIterator is an Iterator implementation that only retries errors
|
| -// if they are transient.
|
| -//
|
| -// (See errors.IsTransient).
|
| +// if they are tagged with `retry.Tag`.
|
| type transientOnlyIterator struct {
|
| Iterator // The wrapped Iterator.
|
| }
|
|
|
| func (i *transientOnlyIterator) Next(ctx context.Context, err error) time.Duration {
|
| - if !errors.IsTransient(err) {
|
| + if !Tag.In(err) {
|
| return Stop
|
| }
|
| return i.Iterator.Next(ctx, err)
|
| @@ -38,3 +36,11 @@ func TransientOnly(f Factory) Factory {
|
| return &transientOnlyIterator{it}
|
| })
|
| }
|
| +
|
| +// Tag is used to indicate that an error should be retried by this package. Use
|
| +// like:
|
| +// err = retry.Tag.Apply(err)
|
| +//
|
| +// This allows libraries to preserve the original error, but indicate to the
|
| +// retry library that the error may be transient.
|
| +var Tag = errors.NewBoolTag("this error may go away with a retry")
|
|
|