File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -248,12 +248,8 @@ bool Checkable::AffectsChildren(const CheckResult::Ptr& cr) const
248248std::set<Checkable::Ptr> Checkable::GetParents () const
249249{
250250 std::set<Checkable::Ptr> parents;
251-
252- for (const Dependency::Ptr& dep : GetDependencies ()) {
253- Checkable::Ptr parent = dep->GetParent ();
254-
255- if (parent && parent.get () != this )
256- parents.insert (parent);
251+ for (auto & dependencyGroup : GetDependencyGroups ()) {
252+ dependencyGroup->LoadParents (parents);
257253 }
258254
259255 return parents;
Original file line number Diff line number Diff line change @@ -146,6 +146,20 @@ std::vector<Dependency::Ptr> DependencyGroup::GetDependenciesForChild(const Chec
146146 return dependencies;
147147}
148148
149+ /* *
150+ * Load all parent Checkables of the current dependency group.
151+ *
152+ * @param parents The set to load the parent Checkables into.
153+ */
154+ void DependencyGroup::LoadParents (std::set<Checkable::Ptr>& parents) const
155+ {
156+ std::lock_guard lock (m_Mutex);
157+ for (auto & [compositeKey, children] : m_Members) {
158+ ASSERT (!children.empty ()); // We should never have an empty map for any given key at any given time.
159+ parents.insert (std::get<0 >(compositeKey));
160+ }
161+ }
162+
149163/* *
150164 * Retrieve the number of dependency objects in the current dependency group.
151165 *
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ class DependencyGroup final : public SharedObject
148148 void AddDependency (const Dependency::Ptr& dependency);
149149 void RemoveDependency (const Dependency::Ptr& dependency);
150150 std::vector<Dependency::Ptr> GetDependenciesForChild (const Checkable* child) const ;
151+ void LoadParents (std::set<Checkable::Ptr>& parents) const ;
151152 size_t GetDependenciesCount () const ;
152153
153154 void SetIcingaDBIdentifier (const String& identifier);
You can’t perform that action at this time.
0 commit comments