package
1.7.0
Repository: https://github.com/eapache/go-resiliency.git
Documentation: pkg.go.dev

# README

deadline

Golang CI GoDoc Code of Conduct

The deadline/timeout resiliency pattern for golang.

Creating a deadline takes one parameter: how long to wait.

dl := deadline.New(1 * time.Second)

err := dl.Run(func(stopper <-chan struct{}) error {
	// do something potentially slow
	// give up when the `stopper` channel is closed (indicating a time-out)
	return nil
})

switch err {
case deadline.ErrTimedOut:
	// execution took too long, oops
default:
	// some other error
}

# Functions

New constructs a new Deadline with the given timeout.

# Variables

ErrTimedOut is the error returned from Run when the deadline expires.

# Structs

Deadline implements the deadline/timeout resiliency pattern.