mirror of https://github.com/Icinga/icinga2.git
Replace concurrent_checks in CheckerComponent by global MaxConcurrentChecks
refs #4841
This commit is contained in:
parent
e28277175b
commit
97bd91dda2
|
@ -161,6 +161,7 @@ static int Main()
|
||||||
Application::DeclareRLimitStack(Application::GetDefaultRLimitStack());
|
Application::DeclareRLimitStack(Application::GetDefaultRLimitStack());
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
Application::DeclareConcurrency(std::thread::hardware_concurrency());
|
Application::DeclareConcurrency(std::thread::hardware_concurrency());
|
||||||
|
Application::DeclareMaxConcurrentChecks(Application::GetDefaultMaxConcurrentChecks());
|
||||||
|
|
||||||
ScriptGlobal::Set("AttachDebugger", false);
|
ScriptGlobal::Set("AttachDebugger", false);
|
||||||
|
|
||||||
|
|
|
@ -1552,6 +1552,48 @@ int Application::GetConcurrency()
|
||||||
return ScriptGlobal::Get("Concurrency", &defaultConcurrency);
|
return ScriptGlobal::Get("Concurrency", &defaultConcurrency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the max concurrent checks.
|
||||||
|
*
|
||||||
|
* @param maxChecks The new limit.
|
||||||
|
*/
|
||||||
|
void Application::SetMaxConcurrentChecks(int maxChecks)
|
||||||
|
{
|
||||||
|
ScriptGlobal::Set("MaxConcurrentChecks", maxChecks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the max concurrent checks.
|
||||||
|
*
|
||||||
|
* @param maxChecks The new limit.
|
||||||
|
*/
|
||||||
|
void Application::DeclareMaxConcurrentChecks(int maxChecks)
|
||||||
|
{
|
||||||
|
if (!ScriptGlobal::Exists("MaxConcurrentChecks"))
|
||||||
|
ScriptGlobal::Set("MaxConcurrentChecks", maxChecks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the max concurrent checks.
|
||||||
|
*
|
||||||
|
* @returns The max number of concurrent checks.
|
||||||
|
*/
|
||||||
|
int Application::GetMaxConcurrentChecks()
|
||||||
|
{
|
||||||
|
Value defaultMaxConcurrentChecks = GetDefaultMaxConcurrentChecks();
|
||||||
|
return ScriptGlobal::Get("MaxConcurrentChecks", &defaultMaxConcurrentChecks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the default value for max concurrent checks.
|
||||||
|
*
|
||||||
|
* @returns The default max number of concurrent checks.
|
||||||
|
*/
|
||||||
|
int Application::GetDefaultMaxConcurrentChecks()
|
||||||
|
{
|
||||||
|
return 512;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the global thread pool.
|
* Returns the global thread pool.
|
||||||
*
|
*
|
||||||
|
|
|
@ -146,6 +146,11 @@ public:
|
||||||
static int GetConcurrency();
|
static int GetConcurrency();
|
||||||
static void DeclareConcurrency(int ncpus);
|
static void DeclareConcurrency(int ncpus);
|
||||||
|
|
||||||
|
static int GetMaxConcurrentChecks();
|
||||||
|
static int GetDefaultMaxConcurrentChecks();
|
||||||
|
static void DeclareMaxConcurrentChecks(int maxChecks);
|
||||||
|
static void SetMaxConcurrentChecks(int maxChecks);
|
||||||
|
|
||||||
static ThreadPool& GetTP();
|
static ThreadPool& GetTP();
|
||||||
|
|
||||||
static String GetAppVersion();
|
static String GetAppVersion();
|
||||||
|
|
|
@ -27,8 +27,14 @@ namespace icinga
|
||||||
class CheckerComponent : ConfigObject
|
class CheckerComponent : ConfigObject
|
||||||
{
|
{
|
||||||
[config] int concurrent_checks {
|
[config] int concurrent_checks {
|
||||||
|
get {{{
|
||||||
|
return Application::GetMaxConcurrentChecks();
|
||||||
|
}}}
|
||||||
|
set {{{
|
||||||
|
Application::SetMaxConcurrentChecks(value);
|
||||||
|
}}}
|
||||||
default {{{
|
default {{{
|
||||||
return 512;
|
return Application::GetDefaultMaxConcurrentChecks();
|
||||||
}}}
|
}}}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue