Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions dotnet/src/dotnetframework/GxClasses/Core/gxconfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ public class Preferences
const string DEFAULT_DS = "Default";
static int httpclient_max_per_route = -1;
static int sessionTimeout = -1;
static int singletonHttpClient = -1;
internal static string AppMainNamespace
{
get
Expand Down Expand Up @@ -1443,6 +1444,18 @@ internal static bool WrapSingleApiOutput
return DefaultWrapSingleApiOutput;
}
}

internal static bool SingletonHttpClient()
{
if (singletonHttpClient == -1)
{
if (Config.GetValueOrEnvironmentVarOf("HTTPCLIENT_SINGLETON", out string sValue) && int.TryParse(sValue, out int value))
singletonHttpClient = value;
else
singletonHttpClient = 1;
}
return singletonHttpClient==1;
}
internal static string CorsAllowedOrigins()
{
if (Config.GetValueOf("CORS_ALLOW_ORIGIN", out string corsOrigin))
Expand Down Expand Up @@ -1484,27 +1497,27 @@ public static string GetDefaultTheme()
else
return "";
}

public static int GetHttpClientMaxConnectionPerRoute()
internal const int DEFAULT_HTTPCLIENT_MAX_PER_ROUTE= 1000;
internal static int GetHttpClientMaxConnectionPerRoute()
{
if (httpclient_max_per_route == -1)
{
try
{
string strmax;
if (Config.GetValueOf("HTTPCLIENT_MAX_PER_ROUTE", out strmax))
if (Config.GetValueOrEnvironmentVarOf("HTTPCLIENT_MAX_PER_ROUTE", out strmax))
{
httpclient_max_per_route = Convert.ToInt32(strmax);
}
else
{
httpclient_max_per_route = 1000;
httpclient_max_per_route = DEFAULT_HTTPCLIENT_MAX_PER_ROUTE;
}
}
catch (Exception ex)
{
GXLogging.Error(log, "HttpClientMaxPerRoute error", ex);
httpclient_max_per_route = 1000;
httpclient_max_per_route = DEFAULT_HTTPCLIENT_MAX_PER_ROUTE;
}
}
return httpclient_max_per_route;
Expand Down
Loading