mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-30 08:06:40 +02:00
449bcb46fe
* new backoff function * use backoff from util/backoff * remove reset atemts * change comment * fmt
15 lines
320 B
Go
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
|
|
}
|