mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 22:24:44 +02:00
Refactor check scheduler some more.
This commit is contained in:
parent
b517943012
commit
0c2bd2cb09
@ -84,12 +84,15 @@ void CheckerComponent::CheckThreadProc(void)
|
|||||||
CheckTimeView::iterator it = idx.begin();
|
CheckTimeView::iterator it = idx.begin();
|
||||||
Service::Ptr service = *it;
|
Service::Ptr service = *it;
|
||||||
|
|
||||||
|
if (!service->HasAuthority("checker")) {
|
||||||
|
m_IdleServices.erase(service);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double wait = service->GetNextCheck() - Utility::GetTime();
|
double wait = service->GetNextCheck() - Utility::GetTime();
|
||||||
|
|
||||||
if (wait > 0) {
|
if (wait > 0) {
|
||||||
/* Make sure the service we just examined can be destroyed while we're waiting. */
|
|
||||||
service.reset();
|
|
||||||
|
|
||||||
/* Wait for the next check. */
|
/* Wait for the next check. */
|
||||||
m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000));
|
m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000));
|
||||||
|
|
||||||
@ -115,18 +118,11 @@ 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) {
|
service->UpdateNextCheck();
|
||||||
service->UpdateNextCheck();
|
|
||||||
|
|
||||||
m_IdleServices.insert(service);
|
m_IdleServices.insert(service);
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user