Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
backoff
✓ github.com/jpillora/backoff
Creates a backoff instance and prints durations for each attempt.
package main
import (
"fmt"
"time"
"github.com/jpillora/backoff"
)
func main() {
b := &backoff.Backoff{
Min: 100 * time.Millisecond,
Max: 10 * time.Second,
Factor: 2,
Jitter: true,
}
for i := 0; i < 5; i++ {
d := b.Duration()
fmt.Printf("Attempt %d: waiting %v\n", i+1, d)
time.Sleep(d)
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.0.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.