control: Don't cache non-group properties
The code was previously adding every single D-Bus
path/interface/property of a service when Manager::addObjects() was
being used to cache D-Bus property values. This was resulting in a lot
of extra items in the cache that fan control would never use.
To fix this, create a single static set of all of the D-Bus paths from
all of the Group objects, which would be the master list of all the
D-Bus paths fan control would ever care about. Then, only add a
path/interface/property to the cache if that path is in that set.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I787c9c36b88d003fe9fe7ac1d517fbb5aa510e4e
diff --git a/control/json/group.cpp b/control/json/group.cpp
index 3b7f990..e100d71 100644
--- a/control/json/group.cpp
+++ b/control/json/group.cpp
@@ -24,6 +24,8 @@
using json = nlohmann::json;
using namespace phosphor::logging;
+std::set<std::string> Group::_allMembers{};
+
Group::Group(const json& jsonObj) : ConfigBase(jsonObj), _service("")
{
setMembers(jsonObj);
@@ -57,6 +59,7 @@
{
_members.emplace_back(member.get<std::string>());
}
+ _allMembers.insert(_members.begin(), _members.end());
}
void Group::setService(const json& jsonObj)