diff --git a/lib/checker/checkercomponent.cpp b/lib/checker/checkercomponent.cpp index fb9d87188fb..bfb997fb6b2 100644 --- a/lib/checker/checkercomponent.cpp +++ b/lib/checker/checkercomponent.cpp @@ -121,7 +121,10 @@ void CheckerComponent::CheckThreadProc(void) double wait = checkable->GetNextCheck() - Utility::GetTime(); - if (wait > 0 || Checkable::GetPendingChecks() >= GetConcurrentChecks()) { + if (Checkable::GetPendingChecks() >= GetConcurrentChecks()) + wait = 0.5; + + if (wait > 0) { /* Wait for the next check. */ m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000)); diff --git a/lib/methods/pluginchecktask.cpp b/lib/methods/pluginchecktask.cpp index c1b1942d9b6..d53e287f846 100644 --- a/lib/methods/pluginchecktask.cpp +++ b/lib/methods/pluginchecktask.cpp @@ -52,11 +52,12 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes resolvers.push_back(std::make_pair("command", commandObj)); resolvers.push_back(std::make_pair("icinga", IcingaApplication::GetInstance())); - Checkable::IncreasePendingChecks(); - PluginUtility::ExecuteCommand(commandObj, checkable, checkable->GetLastCheckResult(), resolvers, resolvedMacros, useResolvedMacros, boost::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1, _2)); + + if (!resolvedMacros || useResolvedMacros) + Checkable::IncreasePendingChecks(); } void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Value& commandLine, const ProcessResult& pr)