Version: v0.0.0-...-25b8fde Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 4 Imported by: 114



Package transient allows you to tag and retry 'transient' errors (i.e. non-permanent errors which may resolve themselves by trying an operation again). This should be used on errors due to network flake, improperly responsive remote servers (e.g. status 500), unusual timeouts, etc. where there's no concrete knowledge that something is permanently wrong.

Said another way, transient errors appear to resolve themselves with nothing other than the passage of time.



This section is empty.


View Source
var Tag = errors.BoolTag{Key: errors.NewTagKey("this error is temporary")}

Tag is used to indicate that an error is transient (i.e. something is temporarially wrong).


func Only

func Only(next retry.Factory) retry.Factory

Only returns a retry.Iterator that wraps another retry.Iterator. It will fall through to the wrapped Iterator ONLY if an error with the transient.Tag is encountered; otherwise, it will not retry.

Returns nil if f is nil.


  err := retry.Retry(c, transient.Only(retry.Default), func() error {
    if condition == "red" {
		   // This error isn't transient, so it won't be retried.
		   return errors.New("fatal bad condition")
    } elif condition == "green" {
		   // This isn't an error, so it won't be retried.
		   return nil
    // This will get retried, because it's transient.
    return errors.New("dunno what's wrong", transient.Tag)


This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL