Skip to content

Commit ffb4b8e

Browse files
[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 <[email protected]>
1 parent fba2ca4 commit ffb4b8e

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

tiledb/sm/rest/curl.cc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,10 @@ Status Curl::make_curl_request_common(
559559
set_curl_request_options(url, write_cb, write_cb_state);
560560

561561
/* perform the blocking network transfer */
562-
CURLcode tmp_curl_code = curl_easy_perform_instrumented(url, i);
562+
CURLcode curl_code = curl_easy_perform_instrumented(url, i);
563563

564564
long http_code = 0;
565-
if (tmp_curl_code == CURLE_OK) {
565+
if (curl_code == CURLE_OK) {
566566
if (curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code) !=
567567
CURLE_OK) {
568568
return LOG_STATUS(Status_RestError(
@@ -572,27 +572,21 @@ Status Curl::make_curl_request_common(
572572

573573
// Exit if the request failed and we don't want to retry based on curl or
574574
// HTTP code, or if the write callback has elected to skip retries
575-
if (!should_retry_request(tmp_curl_code, http_code) ||
575+
if (!should_retry_request(curl_code, http_code) ||
576576
write_cb_state.skip_retries) {
577577
break;
578578
}
579579

580-
/* Only store the first non-OK curl code, because it will likely be more
581-
* useful than the curl codes from the retries. */
582-
if (*curl_code == CURLE_OK) {
583-
*curl_code = tmp_curl_code;
584-
}
585-
586580
// Set up the actual retry logic
587581
// Only sleep if this isn't the last failed request allowed
588582
if (i < retry_count_ - 1) {
589-
if (tmp_curl_code != CURLE_OK) {
583+
if (curl_code != CURLE_OK) {
590584
global_logger().debug(
591585
"Request to {} failed with Curl error message \"{}\", will sleep "
592586
"{}ms, "
593587
"retry count {}",
594588
url,
595-
get_curl_errstr(tmp_curl_code),
589+
get_curl_errstr(curl_code),
596590
retry_delay,
597591
i);
598592
} else {

0 commit comments

Comments
 (0)