Skip to content

Latest commit

 

History

History

retry

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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()),
)