backoff := utils.NewSimpleRetryStrategy(3, time.Second) attempt := backoff.Start(func() (bool, error) { // Do something here return true, nil }) attempt.Wait()
backoff := utils.AttemptStrategy{ Min: time.Second, Max: time.Second * 5, Factor: 1, Attempt: 5, } attempt := backoff.Start(func() (bool, error) { // Do something here return true, nil }) attempt.Wait()In both examples, the code sets up a retry strategy and uses it to create an Attempt that wraps around the operation to be executed. The Wait method waits for the operation to complete, either successfully or after exhausting all retries.