]> granicus.if.org Git - icinga2/commitdiff
checker: Fix incorrect wait time when first service is non-authoritative.
authorGunnar Beutner <gunnar@beutner.name>
Thu, 12 Sep 2013 14:36:18 +0000 (16:36 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 12 Sep 2013 14:36:18 +0000 (16:36 +0200)
components/checker/checkercomponent.cpp

index 392baf3508845b3e9e305a24c190a78a282e972c..a2a5b023af7a3725a3bd3f0796e5b3bf8319c2e8 100644 (file)
@@ -83,6 +83,12 @@ void CheckerComponent::CheckThreadProc(void)
                CheckTimeView::iterator it = idx.begin();
                Service::Ptr service = *it;
 
+               if (!service->HasAuthority("checker")) {
+                       idx.erase(it);
+                       idx.insert(service);
+                       continue;
+               }
+
                if (!service->IsActive()) {
                        idx.erase(it);
                        continue;
@@ -90,11 +96,6 @@ void CheckerComponent::CheckThreadProc(void)
 
                double wait = service->GetNextCheck() - Utility::GetTime();
 
-               bool authoritative = service->HasAuthority("checker");
-
-               if (!authoritative)
-                       wait = 60;
-
                if (wait > 0) {
                        /* Make sure the service we just examined can be destroyed while we're waiting. */
                        service.reset();
@@ -110,6 +111,7 @@ void CheckerComponent::CheckThreadProc(void)
 
                bool forced = service->GetForceNextCheck();
                bool check = true;
+               bool authoritative = service->HasAuthority("checker");
 
                if (!forced) {
                        if (!service->GetEnableActiveChecks()) {