mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 17:28:56 +00:00
Implement exponential backoff for 503
Amazon returns SlowDown when overloaded. Also return ENOTSUP for 501 and immediately return EIO for 500 instead of retrying. Fixes #603.
This commit is contained in:
parent
a442e843be
commit
8ff05d8e38
18
src/curl.cpp
18
src/curl.cpp
@ -2065,7 +2065,7 @@ int S3fsCurl::RequestPerform(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1 attempt + retries...
|
// 1 attempt + retries...
|
||||||
for(int retrycnt = S3fsCurl::retries; 0 < retrycnt; retrycnt--){
|
for(int retrycnt = 0; retrycnt < S3fsCurl::retries; ++retrycnt){
|
||||||
// Requests
|
// Requests
|
||||||
CURLcode curlCode = curl_easy_perform(hCurl);
|
CURLcode curlCode = curl_easy_perform(hCurl);
|
||||||
|
|
||||||
@ -2081,11 +2081,6 @@ int S3fsCurl::RequestPerform(void)
|
|||||||
S3FS_PRN_INFO3("HTTP response code %ld", LastResponseCode);
|
S3FS_PRN_INFO3("HTTP response code %ld", LastResponseCode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(500 <= LastResponseCode){
|
|
||||||
S3FS_PRN_ERR("HTTP response code = %ld Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
|
|
||||||
sleep(4);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Service response codes which are >= 300 && < 500
|
// Service response codes which are >= 300 && < 500
|
||||||
switch(LastResponseCode){
|
switch(LastResponseCode){
|
||||||
@ -2108,6 +2103,17 @@ int S3fsCurl::RequestPerform(void)
|
|||||||
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
|
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
|
case 501:
|
||||||
|
S3FS_PRN_INFO3("HTTP response code 501 was returned, returning ENOTSUP");
|
||||||
|
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
|
||||||
|
return -ENOTSUP;
|
||||||
|
|
||||||
|
case 503:
|
||||||
|
S3FS_PRN_INFO3("HTTP response code 503 was returned, slowing down");
|
||||||
|
S3FS_PRN_DBG("Body Text: %s", (bodydata ? bodydata->str() : ""));
|
||||||
|
sleep(4 << retry_count);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
S3FS_PRN_ERR("HTTP response code %ld, returning EIO. Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
|
S3FS_PRN_ERR("HTTP response code %ld, returning EIO. Body Text: %s", LastResponseCode, (bodydata ? bodydata->str() : ""));
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
Loading…
Reference in New Issue
Block a user