Http: fixed condition for retry (if retry enabled)

This commit is contained in:
Jan Bařtipán 2024-09-11 11:01:01 +02:00 committed by Lukas Matena
parent 5b79c8b50a
commit 3b8d34ec5f
2 changed files with 4 additions and 2 deletions

View File

@ -398,8 +398,8 @@ void Http::priv::http_perform(const HttpRetryOpt& retry_opts)
if (res == CURLE_OK)
::curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_status);
retry = is_transient_error(res, http_status);
if (retry && num_retries >= retry_opts.max_retries)
retry = retry_opts.initial_delay > 0ms && is_transient_error(res, http_status);
if (retry && retry_opts.max_retries > 0 && num_retries >= retry_opts.max_retries)
retry = false;
if (retry) {
num_retries++;

View File

@ -17,8 +17,10 @@ namespace Slic3r {
struct HttpRetryOpt
{
// if set to zero, no retries at all
std::chrono::milliseconds initial_delay;
std::chrono::milliseconds max_delay;
// if set to zero, retries forever
size_t max_retries{0};
static const HttpRetryOpt& no_retry();