Skip to content

Commit 45851bc

Browse files
committed
Checkable#ProcessCheckResult(): discard CR or delay its producers shutdown
1 parent 342b57a commit 45851bc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/icinga/checkable-check.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "base/convert.hpp"
1515
#include "base/utility.hpp"
1616
#include "base/context.hpp"
17+
#include <shared_mutex>
1718

1819
using namespace icinga;
1920

@@ -101,6 +102,7 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr
101102
using Result = Checkable::ProcessingResult;
102103

103104
VERIFY(cr);
105+
VERIFY(producer);
104106

105107
{
106108
ObjectLock olock(this);
@@ -135,6 +137,14 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr
135137
cr->SetCheckSource(command_endpoint->GetName());
136138
}
137139

140+
std::shared_lock producerLock (*producer, std::try_to_lock);
141+
142+
if (!producerLock) {
143+
// Discard the check result to not delay the current reload.
144+
// We'll re-run the check immediately after the reload.
145+
return Result::CheckableInactive;
146+
}
147+
138148
/* agent checks go through the api */
139149
if (command_endpoint && GetExtension("agent_check")) {
140150
ApiListener::Ptr listener = ApiListener::GetInstance();

0 commit comments

Comments
 (0)