mirror of https://github.com/Icinga/icinga2.git
Refactor check scheduler.
This commit is contained in:
parent
dc566bf145
commit
b517943012
|
@ -91,8 +91,7 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
service.reset();
|
service.reset();
|
||||||
|
|
||||||
/* Wait for the next check. */
|
/* Wait for the next check. */
|
||||||
if (!m_Stopped)
|
m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000));
|
||||||
m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000));
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +100,6 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
|
|
||||||
bool forced = service->GetForceNextCheck();
|
bool forced = service->GetForceNextCheck();
|
||||||
bool check = true;
|
bool check = true;
|
||||||
bool authoritative = service->HasAuthority("checker");
|
|
||||||
|
|
||||||
if (!forced) {
|
if (!forced) {
|
||||||
if (!service->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableChecks()) {
|
if (!service->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableChecks()) {
|
||||||
|
@ -117,20 +115,22 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool authoritative = service->HasAuthority("checker");
|
||||||
|
|
||||||
|
if (!authoritative)
|
||||||
|
check = false;
|
||||||
|
|
||||||
/* reschedule the service if checks are disabled */
|
/* reschedule the service if checks are disabled */
|
||||||
if (!check) {
|
if (!check) {
|
||||||
if (authoritative)
|
if (authoritative) {
|
||||||
service->UpdateNextCheck();
|
service->UpdateNextCheck();
|
||||||
|
|
||||||
typedef boost::multi_index::nth_index<ServiceSet, 1>::type CheckTimeView;
|
m_IdleServices.insert(service);
|
||||||
CheckTimeView& idx = boost::get<1>(m_IdleServices);
|
}
|
||||||
|
|
||||||
idx.insert(service);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_IdleServices.erase(service);
|
|
||||||
m_PendingServices.insert(service);
|
m_PendingServices.insert(service);
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
Loading…
Reference in New Issue