This patch changes the way checkresults are handled during a restart.
1. Check results coming in during a shutdown are ignored.
2. Upon start, checks which should have ran (next_check in the past),
are re-scheduled within the first minute.
This new behavior means there will be no more "Unknown - Terminated"
checkresults during a restart and checks with high check_interval will
be run earlier if they were already scheduled to run. The downside is
that after Icinga2 was down for a while, there will be a lot of checks
within the first minute. Our max concurrent check should take care of
this though.
m_CheckRunning = false;
}
- if (!cr)
+ if (!cr || !IsActive())
return;
double now = Utility::GetTime();
double scheduled_start = GetNextCheck();
double before_check = Utility::GetTime();
- UpdateNextCheck();
-
bool reachable = IsReachable();
{
{
double now = Utility::GetTime();
- if (GetNextCheck() < now + 300)
- UpdateNextCheck();
+ if (GetNextCheck() < now + 60) {
+ double delta = std::min(GetCheckInterval(), 60.0);
+ delta *= (double)std::rand() / RAND_MAX;
+ SetNextCheck(now + delta);
+ }
ObjectImpl<Checkable>::Start(runtimeCreated);
}