func newAsyncWorker( id int, client mode.AsyncProtocolClient, ctx context, waitRetry, maxWaitRetry time.Duration, ) *asyncWorker { return &asyncWorker{ id: id, client: client, backoff: common.NewBackoff(ctx.done, waitRetry, maxWaitRetry), ctx: ctx, } }
// New creates a new single connection mode using exactly one // ProtocolClient connection. func New( client mode.ProtocolClient, maxAttempts int, waitRetry, timeout, maxWaitRetry time.Duration, ) (*Mode, error) { s := &Mode{ conn: client, timeout: timeout, backoff: common.NewBackoff(nil, waitRetry, maxWaitRetry), maxAttempts: maxAttempts, } return s, nil }