SH-4176 WIP - allow retries on 4xx errors if enabled by flag. So enable in the case of appearance requests.
parent
43224062a6
commit
96a2173c64
|
|
@ -2871,7 +2871,8 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder
|
|||
public:
|
||||
RequestAgentUpdateAppearanceResponder()
|
||||
{
|
||||
mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10);
|
||||
bool retry_on_4xx = true;
|
||||
mRetryPolicy = new LLAdaptiveRetryPolicy(1.0, 32.0, 2.0, 10, retry_on_4xx);
|
||||
}
|
||||
|
||||
virtual ~RequestAgentUpdateAppearanceResponder()
|
||||
|
|
|
|||
|
|
@ -28,11 +28,12 @@
|
|||
|
||||
#include "llhttpretrypolicy.h"
|
||||
|
||||
LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries):
|
||||
LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx):
|
||||
mMinDelay(min_delay),
|
||||
mMaxDelay(max_delay),
|
||||
mBackoffFactor(backoff_factor),
|
||||
mMaxRetries(max_retries)
|
||||
mMaxRetries(max_retries),
|
||||
mRetryOn4xx(retry_on_4xx)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
|
@ -108,7 +109,7 @@ void LLAdaptiveRetryPolicy::onFailureCommon(S32 status, bool has_retry_header_ti
|
|||
llinfos << "Too many retries " << mRetryCount << ", will not retry" << llendl;
|
||||
mShouldRetry = false;
|
||||
}
|
||||
if (!isHttpServerErrorStatus(status))
|
||||
if (!mRetryOn4xx && !isHttpServerErrorStatus(status))
|
||||
{
|
||||
llinfos << "Non-server error " << status << ", will not retry" << llendl;
|
||||
mShouldRetry = false;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public:
|
|||
class LLAdaptiveRetryPolicy: public LLHTTPRetryPolicy
|
||||
{
|
||||
public:
|
||||
LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries);
|
||||
LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx = false);
|
||||
|
||||
// virtual
|
||||
void onSuccess();
|
||||
|
|
@ -88,6 +88,7 @@ private:
|
|||
U32 mRetryCount; // number of times shouldRetry has been called.
|
||||
LLTimer mRetryTimer; // time until next retry.
|
||||
bool mShouldRetry; // Becomes false after too many retries, or the wrong sort of status received, etc.
|
||||
bool mRetryOn4xx; // Normally only retry on 5xx server errors.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -56,12 +56,19 @@ void RetryPolicyTestObject::test<1>()
|
|||
template<> template<>
|
||||
void RetryPolicyTestObject::test<2>()
|
||||
{
|
||||
LLAdaptiveRetryPolicy retry404(1.0,2.0,3.0,10);
|
||||
LLSD headers;
|
||||
F32 wait_seconds;
|
||||
|
||||
retry404.onFailure(404,headers);
|
||||
ensure("no retry on 404", !retry404.shouldRetry(wait_seconds));
|
||||
|
||||
// Normally only retry on server error (5xx)
|
||||
LLAdaptiveRetryPolicy noRetry404(1.0,2.0,3.0,10);
|
||||
noRetry404.onFailure(404,headers);
|
||||
ensure("no retry on 404", !noRetry404.shouldRetry(wait_seconds));
|
||||
|
||||
// Can retry on 4xx errors if enabled by flag.
|
||||
bool do_retry_4xx = true;
|
||||
LLAdaptiveRetryPolicy doRetry404(1.0,2.0,3.0,10,do_retry_4xx);
|
||||
doRetry404.onFailure(404,headers);
|
||||
ensure("do retry on 404", doRetry404.shouldRetry(wait_seconds));
|
||||
}
|
||||
|
||||
template<> template<>
|
||||
|
|
|
|||
Loading…
Reference in New Issue