mirror of https://github.com/Icinga/icinga2.git
Tune thread spawning behavior.
This commit is contained in:
parent
d04a04d897
commit
7ac65b0a47
|
@ -180,8 +180,6 @@ void EventQueue::Post(const EventQueueCallback& callback)
|
||||||
|
|
||||||
void EventQueue::ReportThreadProc(void)
|
void EventQueue::ReportThreadProc(void)
|
||||||
{
|
{
|
||||||
double last_adjustment = 0;
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Utility::Sleep(5);
|
Utility::Sleep(5);
|
||||||
|
|
||||||
|
@ -213,13 +211,12 @@ void EventQueue::ReportThreadProc(void)
|
||||||
m_Latency = 0;
|
m_Latency = 0;
|
||||||
m_LatencyCount = 0;
|
m_LatencyCount = 0;
|
||||||
|
|
||||||
if (pending > 0) {
|
if (pending > alive - busy) {
|
||||||
/* Spawn a few additional workers. */
|
/* Spawn a few additional workers. */
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
SpawnWorker();
|
SpawnWorker();
|
||||||
} else if (last_adjustment < now - 30) {
|
} else {
|
||||||
KillWorker();
|
KillWorker();
|
||||||
last_adjustment = now;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue