mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Add error retry detail for HTTP retries.
This should make it clearer when retries have happened and for how long.
This commit is contained in:
parent
df419b34b5
commit
f33e1cfb16
@ -16,6 +16,15 @@
|
|||||||
<release-list>
|
<release-list>
|
||||||
<release date="XXXX-XX-XX" version="2.46dev" title="UNDER DEVELOPMENT">
|
<release date="XXXX-XX-XX" version="2.46dev" title="UNDER DEVELOPMENT">
|
||||||
<release-core-list>
|
<release-core-list>
|
||||||
|
<release-improvement-list>
|
||||||
|
<release-item>
|
||||||
|
<commit subject="Move error modules to common/error directory."/>
|
||||||
|
<commit subject="Improve retry error messages."/>
|
||||||
|
|
||||||
|
<p>Add error retry detail for HTTP retries.</p>
|
||||||
|
</release-item>
|
||||||
|
</release-improvement-list>
|
||||||
|
|
||||||
<release-development-list>
|
<release-development-list>
|
||||||
<release-item>
|
<release-item>
|
||||||
<commit subject="Add reference filter and output to manifest command."/>
|
<commit subject="Add reference filter and output to manifest command."/>
|
||||||
|
@ -4,6 +4,7 @@ HTTP Request
|
|||||||
#include "build.auto.h"
|
#include "build.auto.h"
|
||||||
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/error/retry.h"
|
||||||
#include "common/io/http/common.h"
|
#include "common/io/http/common.h"
|
||||||
#include "common/io/http/request.h"
|
#include "common/io/http/request.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
@ -73,6 +74,7 @@ httpRequestProcess(HttpRequest *this, bool waitForResponse, bool contentCache)
|
|||||||
MEM_CONTEXT_TEMP_BEGIN()
|
MEM_CONTEXT_TEMP_BEGIN()
|
||||||
{
|
{
|
||||||
bool retry;
|
bool retry;
|
||||||
|
ErrorRetry *const errRetry = errRetryNew();
|
||||||
Wait *wait = waitNew(httpClientTimeout(this->client));
|
Wait *wait = waitNew(httpClientTimeout(this->client));
|
||||||
|
|
||||||
do
|
do
|
||||||
@ -151,6 +153,9 @@ httpRequestProcess(HttpRequest *this, bool waitForResponse, bool contentCache)
|
|||||||
}
|
}
|
||||||
CATCH_ANY()
|
CATCH_ANY()
|
||||||
{
|
{
|
||||||
|
// Add the error retry info
|
||||||
|
errRetryAdd(errRetry);
|
||||||
|
|
||||||
// Sleep and then retry unless the total wait time has expired
|
// Sleep and then retry unless the total wait time has expired
|
||||||
if (waitMore(wait))
|
if (waitMore(wait))
|
||||||
{
|
{
|
||||||
@ -160,7 +165,7 @@ httpRequestProcess(HttpRequest *this, bool waitForResponse, bool contentCache)
|
|||||||
statInc(HTTP_STAT_RETRY_STR);
|
statInc(HTTP_STAT_RETRY_STR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
RETHROW();
|
THROWP(errRetryType(errRetry), strZ(errRetryMessage(errRetry)));
|
||||||
}
|
}
|
||||||
TRY_END();
|
TRY_END();
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,9 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_ERROR_FMT(
|
TEST_ERROR_FMT(
|
||||||
httpRequestResponse(httpRequestNewP(client, STRDEF("GET"), STRDEF("/")), false), HostConnectError,
|
httpRequestResponse(httpRequestNewP(client, STRDEF("GET"), STRDEF("/")), false), HostConnectError,
|
||||||
"unable to connect to 'localhost:%u': [111] Connection refused", hrnServerPort(0));
|
"unable to connect to 'localhost:%u': [111] Connection refused\n"
|
||||||
|
"[RETRY DETAIL OMITTED]",
|
||||||
|
hrnServerPort(0));
|
||||||
|
|
||||||
HRN_FORK_BEGIN()
|
HRN_FORK_BEGIN()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user