From c6ea9bc7fe93607399d4bdea441db7eaa45695f5 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 10 Dec 2019 15:41:04 +0100 Subject: [PATCH] IcingaDB: update icinga:nextupdate:* on Checkable#next_check changes refs #7707 --- lib/icingadb/icingadb-objects.cpp | 10 ++++++++++ lib/icingadb/icingadb.hpp | 1 + 2 files changed, 11 insertions(+) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index d8d4b02f6..5a4c211e1 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -101,6 +101,9 @@ void IcingaDB::ConfigStaticInitialize() Checkable::OnNewCheckResult.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr&, const MessageOrigin::Ptr&) { IcingaDB::NewCheckResultHandler(checkable); }); + Checkable::OnNextCheckChanged.connect([](const Checkable::Ptr& checkable, const Value&) { + IcingaDB::NextCheckChangedHandler(checkable); + }); Service::OnHostProblemChanged.connect([](const Service::Ptr& service, const CheckResult::Ptr&, const MessageOrigin::Ptr&) { IcingaDB::StateChangeHandler(service); @@ -2042,6 +2045,13 @@ void IcingaDB::NewCheckResultHandler(const Checkable::Ptr& checkable) } } +void IcingaDB::NextCheckChangedHandler(const Checkable::Ptr& checkable) +{ + for (auto& rw : ConfigType::GetObjectsByType()) { + rw->m_WorkQueue.Enqueue([rw, checkable]() { rw->SendNextUpdate(checkable); }); + } +} + struct AuthorComment { String Author; diff --git a/lib/icingadb/icingadb.hpp b/lib/icingadb/icingadb.hpp index 45c506027..8f40a273e 100644 --- a/lib/icingadb/icingadb.hpp +++ b/lib/icingadb/icingadb.hpp @@ -108,6 +108,7 @@ private: static void CommentRemovedHandler(const Comment::Ptr& comment); static void FlappingChangeHandler(const Checkable::Ptr& checkable, double changeTime); static void NewCheckResultHandler(const Checkable::Ptr& checkable); + static void NextCheckChangedHandler(const Checkable::Ptr& checkable); static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry); static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime);