mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-22 16:58:55 +00:00
Add jitter to avoid thundering herd (#1723)
This commit is contained in:
parent
012e6dd8a2
commit
77f0b75d2f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user