github.com/annwntech/go-micro/v2@v2.9.5/client/backoff.go (about)

     1  package client
     2  
     3  import (
     4  	"context"
     5  	"time"
     6  
     7  	"github.com/annwntech/go-micro/v2/util/backoff"
     8  )
     9  
    10  type BackoffFunc func(ctx context.Context, req Request, attempts int) (time.Duration, error)
    11  
    12  func exponentialBackoff(ctx context.Context, req Request, attempts int) (time.Duration, error) {
    13  	return backoff.Do(attempts), nil
    14  }