Check deadline

This commit is contained in:
Mattia Codato 2020-07-13 10:20:23 +02:00
parent 3414acbec1
commit b9510e72dd
1 changed files with 9 additions and 0 deletions

View File

@ -126,6 +126,15 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
return;
}
/* Check deadline */
double deadline = params->Get("deadline");
if (Utility::GetTime() > deadline) {
Log(LogNotice, "ApiListener")
<< "Discarding 'ExecuteCheckFromQueue' event for checkable '" << checkable->GetName()
<< "' from '" << origin->FromClient->GetIdentity() << "': Deadline has expired.";
return;
}
Checkable::ExecuteCommandProcessFinishedHandler = [listener, sourceEndpoint, origin, params] (const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Value& commandLine, const ProcessResult& pr) -> void {
Checkable::CurrentConcurrentChecks.fetch_sub(1);
Checkable::DecreasePendingChecks();