From 9536a14f809bdd7aa71c345ade5b55da6e3f2af6 Mon Sep 17 00:00:00 2001 From: James Feist Date: Thu, 21 Nov 2019 09:02:32 -0800 Subject: Health: Allow populate to only be called once Populate does a mapper call and a get managed objects and should only be called once. Enforce it. Tested: No actual change, it is currently never called twice, this is just for future protection with multiple async calls. Change-Id: I8fb9d8d19b2aa2a1c957a0ac8b609adf5e6ba6d0 Signed-off-by: James Feist --- redfish-core/lib/health.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'redfish-core') diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp index 91279304e5..fe65ebfbcb 100644 --- a/redfish-core/lib/health.hpp +++ b/redfish-core/lib/health.hpp @@ -148,6 +148,11 @@ struct HealthPopulate : std::enable_shared_from_this // being added as children to the 'main' health object for the page void populate() { + if (populated) + { + return; + } + populated = true; getAllStatusAssociations(); getGlobalPath(); } @@ -210,5 +215,6 @@ struct HealthPopulate : std::enable_shared_from_this bool isManagersHealth = false; dbus::utility::ManagedObjectType statuses; std::string globalInventoryPath = "-"; // default to illegal dbus path + bool populated = false; }; } // namespace redfish \ No newline at end of file -- cgit v1.2.3