Downtime#Start(): trigger flexible downtimes not earlier than fixed ones

the last state change could be a long time ago. If it's longer than
the new downtime's duration, the downtime expires immediately.

trigger time + duration < now
This commit is contained in:
Alexander A. Klimov 2023-04-18 16:55:32 +02:00
parent 02ddb4badc
commit 43c4feb645

View File

@ -132,7 +132,8 @@ void Downtime::Start(bool runtimeCreated)
Log(LogNotice, "Downtime")
<< "Checkable '" << checkable->GetName() << "' already in a NOT-OK state."
<< " Triggering downtime now.";
TriggerDowntime(checkable->GetLastStateChange());
TriggerDowntime(std::fmax(std::fmax(GetStartTime(), GetEntryTime()), checkable->GetLastStateChange()));
}
if (GetFixed() && CanBeTriggered()) {