micro/client/backoff.go
tpam28 449bcb46fe
New backoff (#1153)
* new backoff function

* use backoff from util/backoff

* remove reset atemts

* change comment

* fmt
2020-02-02 20:32:55 +00:00

15 lines
320 B
Go

package client
import (
"context"
"time"
"github.com/micro/go-micro/v2/util/backoff"
)
type BackoffFunc func(ctx context.Context, req Request, attempts int) (time.Duration, error)
func exponentialBackoff(ctx context.Context, req Request, attempts int) (time.Duration, error) {
return backoff.Do(attempts), nil
}