Introduce Checkable#next_update

This commit is contained in:
Alexander A. Klimov 2019-09-24 17:54:20 +02:00
parent ac684ec128
commit b8d495ae07
3 changed files with 17 additions and 0 deletions

View File

@ -168,6 +168,19 @@ bool Checkable::GetHandled() const
return GetProblem() && (IsInDowntime() || IsAcknowledged());
}
Timestamp Checkable::GetNextUpdate() const
{
auto cr (GetLastCheckResult());
if (cr) {
return GetNextCheck()
+ (GetProblem() && GetStateType() == StateTypeSoft ? GetRetryInterval() : GetCheckInterval())
+ 2 * (cr->GetExecutionEnd() - cr->GetScheduleStart());
} else {
return GetNextCheck() + GetCheckInterval();
}
}
void Checkable::NotifyFixedDowntimeStart(const Downtime::Ptr& downtime)
{
if (!downtime->GetFixed())

View File

@ -91,6 +91,7 @@ public:
int GetSeverity() const override;
bool GetProblem() const override;
bool GetHandled() const override;
Timestamp GetNextUpdate() const override;
/* Checks */
intrusive_ptr<CheckCommand> GetCheckCommand() const;

View File

@ -132,6 +132,9 @@ abstract class Checkable : CustomVarObject
[no_storage] bool handled {
get;
};
[no_storage] Timestamp next_update {
get;
};
[state] bool force_next_check;
[state] int acknowledgement (AcknowledgementRaw) {