| 239 | } |
| 240 | |
| 241 | void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable) |
| 242 | { |
| 243 | try { |
| 244 | checkable->ExecuteCheck(m_WaitGroup); |
| 245 | } catch (const std::exception& ex) { |
| 246 | CheckResult::Ptr cr = new CheckResult(); |
| 247 | cr->SetState(ServiceUnknown); |
| 248 | |
| 249 | String output = "Exception occurred while checking '" + checkable->GetName() + "': " + DiagnosticInformation(ex); |
| 250 | cr->SetOutput(output); |
| 251 | |
| 252 | double now = Utility::GetTime(); |
| 253 | cr->SetScheduleStart(now); |
| 254 | cr->SetScheduleEnd(now); |
| 255 | cr->SetExecutionStart(now); |
| 256 | cr->SetExecutionEnd(now); |
| 257 | |
| 258 | checkable->ProcessCheckResult(cr, m_WaitGroup); |
| 259 | |
| 260 | Log(LogCritical, "checker", output); |
| 261 | } |
| 262 | |
| 263 | Checkable::DecreasePendingChecks(); |
| 264 | |
| 265 | { |
| 266 | std::unique_lock<std::mutex> lock(m_Mutex); |
| 267 | |
| 268 | /* remove the object from the list of pending objects; if it's not in the |
| 269 | * list this was a manual (i.e. forced) check and we must not re-add the |
| 270 | * object to the list because it's already there. */ |
| 271 | auto it = m_PendingCheckables.find(checkable); |
| 272 | |
| 273 | if (it != m_PendingCheckables.end()) { |
| 274 | m_PendingCheckables.erase(it); |
| 275 | |
| 276 | if (checkable->IsActive()) |
| 277 | m_IdleCheckables.insert(GetCheckableScheduleInfo(checkable)); |
| 278 | |
| 279 | m_CV.notify_all(); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | Log(LogDebug, "CheckerComponent") |
| 284 | << "Check finished for object '" << checkable->GetName() << "'"; |
| 285 | } |
| 286 | |
| 287 | void CheckerComponent::ResultTimerHandler() |
| 288 | { |
nothing calls this directly
no test coverage detected