micro/client/backoff.go

16 lines
364 B
Go
Raw Permalink Normal View History

2016-04-05 20:04:37 +01:00
package client
import (
2018-03-03 11:53:52 +00:00
"context"
2016-04-05 20:04:37 +01:00
"time"
"github.com/unistack-org/micro/v3/util/backoff"
2016-04-05 20:04:37 +01:00
)
// BackoffFunc is the backoff call func
2016-04-05 20:04:37 +01:00
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
2016-04-05 20:04:37 +01:00
}