Http.RetrySystemNonGameThreadSupportEnabled

Http.RetrySystemNonGameThreadSupportEnabled

#Overview

name: Http.RetrySystemNonGameThreadSupportEnabled

This variable is created as a Console Variable (cvar).

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of Http.RetrySystemNonGameThreadSupportEnabled is to enable support for the HTTP retry system on non-game threads. This setting variable is primarily used for the HTTP subsystem within Unreal Engine 5, specifically for managing retry behavior in HTTP requests.

The Unreal Engine subsystem that relies on this setting variable is the HTTP module, which is part of the Online subsystem. This can be seen from the file paths where the variable is referenced, such as “Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp”.

The value of this variable is set using a console variable (CVar) system. It is defined as a TAutoConsoleVariable with a default value of false, meaning the feature is disabled by default.

The associated variable CVarHttpRetrySystemNonGameThreadSupportEnabled interacts directly with Http.RetrySystemNonGameThreadSupportEnabled. They share the same value and are used interchangeably in the code.

Developers must be aware that enabling this variable allows the HTTP retry system to function on non-game threads. This can affect the behavior of HTTP requests, particularly in how they are processed and retried in case of failures.

Best practices when using this variable include:

  1. Only enable it when specifically needed for non-game thread HTTP retry support.
  2. Be cautious of potential performance implications when enabled, as it may affect how HTTP requests are handled across different threads.
  3. Test thoroughly when changing this setting, as it can impact the behavior of HTTP requests throughout the application.

Regarding the associated variable CVarHttpRetrySystemNonGameThreadSupportEnabled:

The purpose of CVarHttpRetrySystemNonGameThreadSupportEnabled is the same as Http.RetrySystemNonGameThreadSupportEnabled. It’s used to control the HTTP retry system’s behavior on non-game threads.

This variable is used in various parts of the HTTP module to conditionally execute code related to non-game thread retry support. For example, it’s checked in functions like HttpOnProcessRequestComplete and HttpOnHeaderReceived to determine whether to proceed with certain operations.

The value of this variable is set through the console variable system and can be accessed using the GetValueOnAnyThread() method.

Developers should be aware that this variable directly controls the behavior of the HTTP retry system on non-game threads. Changing its value can have significant impacts on how HTTP requests are handled, especially in multi-threaded scenarios.

Best practices for using CVarHttpRetrySystemNonGameThreadSupportEnabled include:

  1. Use it consistently with Http.RetrySystemNonGameThreadSupportEnabled, as they are intended to represent the same setting.
  2. Be mindful of its impact on performance and behavior when enabling or disabling it.
  3. Consider the implications on thread safety and synchronization when this feature is enabled.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp:16

Scope: file

Source code excerpt:


TAutoConsoleVariable<bool> CVarHttpRetrySystemNonGameThreadSupportEnabled(
	TEXT("Http.RetrySystemNonGameThreadSupportEnabled"),
	false,
	TEXT("Enable retry system non-game thread support")
);

LLM_DEFINE_TAG(HTTP);

#Associated Variable and Callsites

This variable is associated with another variable named CVarHttpRetrySystemNonGameThreadSupportEnabled. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Programs/WebTests/Private/TestHttp.cpp:37

Scope: file

Source code excerpt:


extern TAutoConsoleVariable<bool> CVarHttpInsecureProtocolEnabled;
extern TAutoConsoleVariable<bool> CVarHttpRetrySystemNonGameThreadSupportEnabled;

class FMockHttpModule : public FHttpModule
{
public:
	using FHttpModule::HttpConnectionTimeout;
	using FHttpModule::HttpTotalTimeout;

#Loc: <Workspace>/Engine/Source/Programs/WebTests/Private/TestHttp.cpp:113

Scope (from outer to inner):

file
class        class FHttpModuleTestFixture
function     FHttpModuleTestFixture

Source code excerpt:

		ParseSettingsFromCommandLine();

		bRetryEnabled &= CVarHttpRetrySystemNonGameThreadSupportEnabled.GetValueOnAnyThread();

		InitModule();

		CVarHttpInsecureProtocolEnabled->Set(true);
	}

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp:15

Scope: file

Source code excerpt:

#include "Misc/CoreDelegates.h"

TAutoConsoleVariable<bool> CVarHttpRetrySystemNonGameThreadSupportEnabled(
	TEXT("Http.RetrySystemNonGameThreadSupportEnabled"),
	false,
	TEXT("Enable retry system non-game thread support")
);

LLM_DEFINE_TAG(HTTP);

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp:202

Scope (from outer to inner):

file
function     void FHttpRetrySystem::FRequest::HttpOnProcessRequestComplete

Source code excerpt:

void FHttpRetrySystem::FRequest::HttpOnProcessRequestComplete(FHttpRequestPtr InHttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded)
{
	if (!CVarHttpRetrySystemNonGameThreadSupportEnabled.GetValueOnAnyThread())
	{
		return;
	}

	TSharedPtr<FManager> RetryManagerPtr = RetryManager.Pin();
	if (!RetryManagerPtr)

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp:301

Scope (from outer to inner):

file
function     void FHttpRetrySystem::FRequest::HttpOnHeaderReceived

Source code excerpt:

void FHttpRetrySystem::FRequest::HttpOnHeaderReceived(FHttpRequestPtr Request, const FString& HeaderName, const FString& NewHeaderValue)
{
	if (!CVarHttpRetrySystemNonGameThreadSupportEnabled.GetValueOnAnyThread())
	{
		return;
	}

	TSharedRef<FRequest> SelfPtr = StaticCastSharedRef<FRequest>(AsShared());
	OnHeaderReceived().ExecuteIfBound(SelfPtr, HeaderName, NewHeaderValue);

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp:498

Scope (from outer to inner):

file
function     void FHttpRetrySystem::FManager::RetryHttpRequestWithDelay
lambda-function

Source code excerpt:

				{
					FManager::FHttpRetryRequestEntry* HttpRetryRequestEntry = &RetryManagerPtr->RequestList[EntryIndex];
					// TODO: Move this into RetryHttpRequest after stablizing the flow with CVarHttpRetrySystemNonGameThreadSupportEnabled on
					HttpRetryRequestEntry->Request->LastResponse = HttpRetryRequestEntry->Request->GetResponse();
					HttpRetryRequestEntry->Request->bLastSucceeded = bWasSucceeded;
					RetryManagerPtr->RetryHttpRequest(*HttpRetryRequestEntry);
				}
			}
		}

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp:564

Scope (from outer to inner):

file
function     bool FHttpRetrySystem::FManager::Update

Source code excerpt:

bool FHttpRetrySystem::FManager::Update(uint32* FileCount, uint32* FailingCount, uint32* FailedCount, uint32* CompletedCount)
{
	if (CVarHttpRetrySystemNonGameThreadSupportEnabled.GetValueOnAnyThread())
	{
		return true;
	}

	QUICK_SCOPE_CYCLE_COUNTER(STAT_FHttpRetrySystem_FManager_Update);
	LLM_SCOPE_BYTAG(HTTP);

#Loc: <Workspace>/Engine/Source/Runtime/Online/HTTP/Private/HttpRetrySystem.cpp:818

Scope (from outer to inner):

file
function     bool FHttpRetrySystem::FManager::ProcessRequest

Source code excerpt:

	QUICK_SCOPE_CYCLE_COUNTER(STAT_FHttpRetrySystem_FManager_ProcessRequest);

	if (CVarHttpRetrySystemNonGameThreadSupportEnabled.GetValueOnAnyThread())
	{
		// Let the request trigger timeout by itself, instead of ticking it in retry system
		if (HttpRetryRequest->RetryTimeoutRelativeSecondsOverride.IsSet())
		{
			HttpRetryRequest->SetTimeout(HttpRetryRequest->RetryTimeoutRelativeSecondsOverride.GetValue());
		}