Documentation
¶
Overview ¶
Package retry provides a generic async slot function executor with retries for robustness against network failures. Functions are linked to a slot, executed asynchronously and network or context errors retried with backoff until duties related to a slot have elapsed (5 slots later).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Retryer ¶
type Retryer struct {
// contains filtered or unexported fields
}
Retryer provides execution of functions asynchronously with retry adding robustness to network errors.
func NewForT ¶
func NewForT( _ *testing.T, ctxTimeoutFunc func(ctx context.Context, slot int64) (context.Context, context.CancelFunc), backoffProvider func() func() <-chan time.Time, ) (*Retryer, error)
NewForT returns a new Retryer instance for testing supporting a custom clock.
func (*Retryer) DoAsync ¶
func (r *Retryer) DoAsync(parent context.Context, slot int64, name string, fn func(context.Context) error)
DoAsync will execute the function including retries on network or context errors. It is intended to be used asynchronously:
go retryer.DoAsync(ctx, duty.Slot, "foo", fn)
Click to show internal directories.
Click to hide internal directories.