manager: rate limit dbus errors
If there is a misconfiguration between sysfs and led-manager,
the manager will be very spammy about dbus errors at it tries
to update the sysfs value. Rate limit this to once per hour
per LED.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2896377ff64318159ca3963d09c2ab5bf7452862
diff --git a/manager/manager.hpp b/manager/manager.hpp
index f211461..0bdcc33 100644
--- a/manager/manager.hpp
+++ b/manager/manager.hpp
@@ -7,6 +7,7 @@
#include <sdeventplus/event.hpp>
#include <sdeventplus/utility/timer.hpp>
+#include <chrono>
#include <set>
#include <string>
#include <unordered_map>
@@ -122,9 +123,8 @@
*
* @return: - 0: success, -1: LED set failed
*/
- static int drivePhysicalLED(const std::string& objPath,
- Layout::Action action, uint8_t dutyOn,
- uint16_t period);
+ int drivePhysicalLED(const std::string& objPath, Layout::Action action,
+ uint8_t dutyOn, uint16_t period);
/** @brief Set lamp test callback when enabled lamp test.
*
@@ -157,6 +157,11 @@
/** @brief Contains the required set of deassert LEDs action */
ActionSet reqLedsDeAssert;
+ /** @brief Map to store the last error time for physical LED paths */
+ std::unordered_map<std::string,
+ std::chrono::time_point<std::chrono::steady_clock>>
+ physicalLEDErrors;
+
/** @brief LEDs handler callback */
void driveLedsHandler();