retry

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package retry provides a simple retry utility with exponential backoff.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(ctx context.Context, cfg Config, fn func() error) error

Do retries fn up to cfg.MaxAttempts times with exponential backoff. Returns the last error if all attempts fail.

Types

type Config

type Config struct {
	MaxAttempts int
	InitialWait time.Duration
	MaxWait     time.Duration
	Multiplier  float64
}

Config holds retry configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a reasonable default retry configuration.

Jump to

Keyboard shortcuts

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