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 0ac1cd1ecb
commit 58b788cd51
1 changed files with 2 additions and 1 deletions

View File

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