Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 386 Bytes

README.md

File metadata and controls

17 lines (13 loc) · 386 Bytes

retry

Backoff retry with Idempotency-Key

var cont Content

bo := backoff.NewExponentialBackOff()
bo.InitialInterval = 50 * time.Millisecond
bo.MaxInterval = 500 * time.Millisecond

err := hx.Get(ctx, "https://api.example.com/contents/1",
	retry.When(hx.Any(hx.IsServerError, hx.IsTemporaryError), bo),
	hx.WhenSuccess(hx.AsJSON(&cont)),
	hx.WhenFailure(hx.AsError()),
)