diff --git a/src/curl.cpp b/src/curl.cpp index 27fe9be..5eeda1d 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -2382,12 +2382,14 @@ int S3fsCurl::RequestPerform(bool dontAddAuthHeaders /*=false*/) break; case 500: - case 503: + case 503: { S3FS_PRN_INFO3("HTTP response code %ld was returned, slowing down", responseCode); S3FS_PRN_DBG("Body Text: %s", bodydata.str()); - sleep(4 << retry_count); + // Add jitter to avoid thundering herd. + unsigned int sleep_time = 2 << retry_count; + sleep(sleep_time + random() % sleep_time); break; - + } default: S3FS_PRN_ERR("HTTP response code %ld, returning EIO. Body Text: %s", responseCode, bodydata.str()); result = -EIO;