Codebase list golang-github-go-kit-kit / 4d7f84d
Merge pull request #126 from jesselucas/patch-1 Testing if LoadBalancer is nil before Retry Peter Bourgon 8 years ago
1 changed file(s) with 4 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1414 // balancer. Requests that return errors will be retried until they succeed,
1515 // up to max times, or until the timeout is elapsed, whichever comes first.
1616 func Retry(max int, timeout time.Duration, lb LoadBalancer) endpoint.Endpoint {
17 if lb == nil {
18 panic("nil LoadBalancer")
19 }
20
1721 return func(ctx context.Context, request interface{}) (interface{}, error) {
1822 var (
1923 newctx, cancel = context.WithTimeout(ctx, timeout)