Hi all, I've released backoff, a small package for generating backoff durations in retry loops using Go 1.23+ iterators.
Repo: https://github.com/mzattahri/backoff Docs: https://pkg.go.dev/mz.attahri.com/code/backoff/v2 Basic usage: ``` for attempt := range backoff.Attempts(ctx, time.Second, 30*time.Second, backoff.Exponential(2), 5) { if err := doSomething(); err == nil { return nil } } return errors.New("max retries exceeded") ``` It supports linear, incremental and exponential step functions, as well as context cancelation, and jitter. Feedback and contributions welcome! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/153cad94-4dbb-48c3-9b72-c37080266040n%40googlegroups.com.
