backoff

package
v0.0.0-...-a5f7211 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Exponential backoff

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func() time.Duration

when an operation is reasonably expected to fail at times and retry attempts should be done, this function should be called after each attempt to get the new duration before the next attempt should be tried.

usual implementations are expected to return different duration for each call, like [0ms, 100ms, 200ms, 400ms, ...]

func ExponentialWithCappedMax

func ExponentialWithCappedMax(base time.Duration, max time.Duration) Func

given (100ms, 1s) => [0ms, 100ms, 200ms, 400ms, 800ms, 1s, 1s, 1s, ...]

func Fixed

func Fixed(dur time.Duration) Func

uses a fixed duration for backoff (always returns e.g. 1s, 1s, ...)

Jump to

Keyboard shortcuts

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