From ffb4b8e87f2c737e5635a83841b7aa36890d9e04 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:43:32 +0200 Subject: [PATCH] [Backport release-2.26] Fix emitting error in successful retry. (#5287) (#5288) Backport of #5287 to release-2.26 --- TYPE: NO_HISTORY Co-authored-by: Ypatia Tsavliri --- tiledb/sm/rest/curl.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tiledb/sm/rest/curl.cc b/tiledb/sm/rest/curl.cc index 38e734f4906..1340fdaa8c7 100644 --- a/tiledb/sm/rest/curl.cc +++ b/tiledb/sm/rest/curl.cc @@ -559,10 +559,10 @@ Status Curl::make_curl_request_common( set_curl_request_options(url, write_cb, write_cb_state); /* perform the blocking network transfer */ - CURLcode tmp_curl_code = curl_easy_perform_instrumented(url, i); + CURLcode curl_code = curl_easy_perform_instrumented(url, i); long http_code = 0; - if (tmp_curl_code == CURLE_OK) { + if (curl_code == CURLE_OK) { if (curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code) != CURLE_OK) { return LOG_STATUS(Status_RestError( @@ -572,27 +572,21 @@ Status Curl::make_curl_request_common( // Exit if the request failed and we don't want to retry based on curl or // HTTP code, or if the write callback has elected to skip retries - if (!should_retry_request(tmp_curl_code, http_code) || + if (!should_retry_request(curl_code, http_code) || write_cb_state.skip_retries) { break; } - /* Only store the first non-OK curl code, because it will likely be more - * useful than the curl codes from the retries. */ - if (*curl_code == CURLE_OK) { - *curl_code = tmp_curl_code; - } - // Set up the actual retry logic // Only sleep if this isn't the last failed request allowed if (i < retry_count_ - 1) { - if (tmp_curl_code != CURLE_OK) { + if (curl_code != CURLE_OK) { global_logger().debug( "Request to {} failed with Curl error message \"{}\", will sleep " "{}ms, " "retry count {}", url, - get_curl_errstr(tmp_curl_code), + get_curl_errstr(curl_code), retry_delay, i); } else {