Skip to content

Commit

Permalink
Remove emitting error in successful retry
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatia committed Sep 5, 2024
1 parent dc00b3b commit df9dc9b
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions tiledb/sm/rest/curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 {
Expand Down

0 comments on commit df9dc9b

Please sign in to comment.