Checkable#ProcessCheckResult(): discard CR or delay its producers shutdown

This commit is contained in:
Alexander A. Klimov 2025-05-20 13:02:26 +02:00
parent f4691dd054
commit 36743f3100

View File

@ -14,6 +14,7 @@
#include "base/convert.hpp"
#include "base/utility.hpp"
#include "base/context.hpp"
#include <shared_mutex>
using namespace icinga;
@ -101,6 +102,7 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr
using Result = Checkable::ProcessingResult;
VERIFY(cr);
VERIFY(producer);
{
ObjectLock olock(this);
@ -135,6 +137,14 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr
cr->SetCheckSource(command_endpoint->GetName());
}
std::shared_lock producerLock (*producer, std::try_to_lock);
if (!producerLock) {
// Discard the check result to not delay the current reload.
// We'll re-run the check immediately after the reload.
return Result::CheckableInactive;
}
/* agent checks go through the api */
if (command_endpoint && GetExtension("agent_check")) {
ApiListener::Ptr listener = ApiListener::GetInstance();