From 62e321fcbfc2d1d2929b89783c2f359f9e352df4 Mon Sep 17 00:00:00 2001 From: yahavi Date: Mon, 25 Dec 2023 14:11:17 +0200 Subject: [PATCH] CR --- http/httpclient/client.go | 2 +- utils/io/httputils/httpclient.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/http/httpclient/client.go b/http/httpclient/client.go index 3beb5efe9..999a9ee95 100644 --- a/http/httpclient/client.go +++ b/http/httpclient/client.go @@ -131,7 +131,7 @@ func (jc *HttpClient) Send(method, url string, content []byte, followRedirect, c if resp == nil { return false, errorutils.CheckErrorf("%sReceived empty response from server", logMsgPrefix) } - if shouldRetry := jc.shouldRetry(resp, &httpClientsDetails); !shouldRetry { + if !jc.shouldRetry(resp, &httpClientsDetails) { return false, nil } // Perform retry diff --git a/utils/io/httputils/httpclient.go b/utils/io/httputils/httpclient.go index 4de19545c..9d86a7eb1 100644 --- a/utils/io/httputils/httpclient.go +++ b/utils/io/httputils/httpclient.go @@ -16,7 +16,8 @@ type HttpClientDetails struct { Transport *http.Transport DialTimeout time.Duration OverallRequestTimeout time.Duration - PreRetryInterceptors []PreRetryInterceptor + // Prior to each retry attempt, the list of PreRetryInterceptors is invoked sequentially. If any of these interceptors yields a 'false' response, the retry process stops instantly. + PreRetryInterceptors []PreRetryInterceptor } type PreRetryInterceptor func() (shouldRetry bool)