package backoff
import "tailscale.com/logtail/backoff"
Package backoff provides a back-off timer type.
Index ¶
Types ¶
type Backoff ¶
type Backoff struct { // tstime.Clock.NewTimer is used instead time.NewTimer. Clock tstime.Clock // LogLongerThan sets the minimum time of a single backoff interval // before we mention it in the log. LogLongerThan time.Duration // contains filtered or unexported fields }
Backoff tracks state the history of consecutive failures and sleeps an increasing amount of time, up to a provided limit.
func NewBackoff ¶
NewBackoff returns a new Backoff timer with the provided name (for logging), logger, and max backoff time. By default, all failures (calls to BackOff with a non-nil err) are logged unless the returned Backoff.LogLongerThan is adjusted.
func (*Backoff) BackOff ¶
BackOff sleeps an increasing amount of time if err is non-nil while the context is active. It resets the backoff schedule once err is nil.
Source Files ¶
backoff.go
- Version
- v1.84.1 (latest)
- Published
- May 29, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 2 days ago –
Tools for package owners.