Fix flexible downtimes expiry time and removal

fixes #12395
This commit is contained in:
Michael Friedrich 2016-08-10 17:14:10 +02:00
parent e09fb88cae
commit 8389d01998
2 changed files with 18 additions and 1 deletions

View File

@ -153,6 +153,10 @@ void Checkable::NotifyDowntimeInternal(const Downtime::Ptr& downtime)
void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime)
{
/* don't send notifications for flexible downtimes which never triggered */
if (!downtime->GetFixed() && !downtime->IsTriggered())
return;
Checkable::Ptr checkable = downtime->GetCheckable();
if (!checkable->IsPaused())

View File

@ -180,7 +180,20 @@ bool Downtime::IsTriggered(void) const
bool Downtime::IsExpired(void) const
{
return (GetEndTime() < Utility::GetTime());
double now = Utility::GetTime();
if (GetFixed())
return (GetEndTime() < now);
else {
/* triggered flexible downtime not in effect anymore */
if (IsTriggered() && !IsInEffect())
return true;
/* flexible downtime never triggered */
else if (!IsTriggered() && (GetEndTime() < now))
return true;
else
return false;
}
}
int Downtime::GetNextDowntimeID(void)