1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-27 00:21:08 +02:00

Add HTTP retries to harden against transient S3 network errors.

This commit is contained in:
David Steele
2017-09-03 16:48:41 -04:00
parent 80e5e8db01
commit eea2ccc3ab
5 changed files with 198 additions and 117 deletions

View File

@ -141,6 +141,33 @@ sub run
$self->testResult(sub {${$oHttpClient->responseBody()}}, $strTestData, 'response body read');
}
################################################################################################################################
if ($self->begin('retry'))
{
$self->httpsServer(sub
{
$self->httpsServerAccept();
$self->{oConnection}->write("HTTP/1.1 200 NoContentLengthMessage1\r\n\r\n");
$self->httpsServerAccept();
$self->{oConnection}->write("HTTP/1.1 200 NoContentLengthMessage2\r\n\r\n");
$self->httpsServerAccept();
$self->httpsServerResponse(200, $strTestData);
});
#---------------------------------------------------------------------------------------------------------------------------
$self->testException(
sub {new pgBackRest::Common::Http::Client(
$strTestHost, HTTP_VERB_GET, {iPort => HTTPS_TEST_PORT, bVerifySsl => false, iTryTotal => 1})},
ERROR_PROTOCOL, 'content-length or transfer-encoding must be defined');
$self->testResult(
sub {new pgBackRest::Common::Http::Client(
$strTestHost, HTTP_VERB_GET, {iPort => HTTPS_TEST_PORT, bVerifySsl => false, iTryTotal => 2})},
'[object]', 'successful retries');
}
}
1;