]> granicus.if.org Git - icinga2/commitdiff
Tune thread spawning behavior.
authorGunnar Beutner <gunnar@beutner.name>
Sat, 23 Mar 2013 11:50:07 +0000 (12:50 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sat, 23 Mar 2013 11:50:07 +0000 (12:50 +0100)
lib/base/eventqueue.cpp

index 8913903ed00b87563db554a261f48d280d3f3382..17d4300becf348bffb682f2184501f259f9eb576 100644 (file)
@@ -180,8 +180,6 @@ void EventQueue::Post(const EventQueueCallback& callback)
 
 void EventQueue::ReportThreadProc(void)
 {
-       double last_adjustment = 0;
-
        for (;;) {
                Utility::Sleep(5);
 
@@ -213,13 +211,12 @@ void EventQueue::ReportThreadProc(void)
                        m_Latency = 0;
                        m_LatencyCount = 0;
 
-                       if (pending > 0) {
+                       if (pending > alive - busy) {
                                /* Spawn a few additional workers. */
                                for (int i = 0; i < 2; i++)
                                        SpawnWorker();
-                       } else if (last_adjustment < now - 30) {
+                       } else {
                                KillWorker();
-                               last_adjustment = now;
                        }
                }