MCPcopy Create free account
hub / github.com/Icinga/icinga2 / EnqueueCheck

Method EnqueueCheck

lib/icinga/clusterevents-check.cpp:53–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void ClusterEvents::EnqueueCheck(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
54{
55 static boost::once_flag once = BOOST_ONCE_INIT;
56
57 boost::call_once(once, []() {
58 m_LogTimer = Timer::Create();
59 m_LogTimer->SetInterval(10);
60 m_LogTimer->OnTimerExpired.connect([](const Timer * const&) { LogRemoteCheckQueueInformation(); });
61 m_LogTimer->Start();
62 });
63
64 std::unique_lock<std::mutex> lock(m_Mutex);
65
66 if (m_CheckRequestQueue.size() >= 25000) {
67 m_ChecksDroppedDuringInterval++;
68 return;
69 }
70
71 m_CheckRequestQueue.emplace_back([origin, params]() { ExecuteCheckFromQueue(origin, params); });
72
73 if (!m_CheckSchedulerRunning) {
74 std::thread t(ClusterEvents::RemoteCheckThreadProc);
75 t.detach();
76 m_CheckSchedulerRunning = true;
77 }
78}
79
80static void SendEventExecutedCommand(const Dictionary::Ptr& params, long exitStatus, const String& output,
81 double start, double end, const ApiListener::Ptr& listener, const MessageOrigin::Ptr& origin,

Callers

nothing calls this directly

Calls 3

SetIntervalMethod · 0.80
StartMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected