Documentation ¶
Overview ¶
Package retry contains utilities for retrying an action until it succeeds.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct { // These two fields must be initialized. // Floor should never be greater than or equal // to the Ceil in general. If it is, the Backoff // will stop backing off and just sleep for the Floor // in Wait(). Floor time.Duration Ceil time.Duration // contains filtered or unexported fields }
Backoff holds state about a backoff loop in which there should be a delay in iterations.
type Listener ¶
Example ¶
package main import ( "log" "net" "go.coder.com/retry" ) func main() { l, err := net.Listen("tcp", "localhost:0") if err != nil { log.Fatalf("failed to listen: %v", err) } defer l.Close() l = retry.Listener{ Listener: l, } for { c, err := l.Accept() if err != nil { log.Fatalf("failed to accept: %v", err) } defer c.Close() // ... } }
Output:
Click to show internal directories.
Click to hide internal directories.