From 84019ba27a83706044ef62c0f102cc5709d7e9b3 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 3 Apr 2019 13:50:21 +0200 Subject: [PATCH] Fix notification skip for local non-API enabled setups W/o local endpoint, these reminder notifications would have been skipped otherwise. PR #6935 improved the logging and made this problem visible. Thanks @nilmerg :) --- lib/notification/notificationcomponent.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/notification/notificationcomponent.cpp b/lib/notification/notificationcomponent.cpp index 57ef3011d..36fe8ecaa 100644 --- a/lib/notification/notificationcomponent.cpp +++ b/lib/notification/notificationcomponent.cpp @@ -64,13 +64,17 @@ void NotificationComponent::NotificationTimerHandler() { double now = Utility::GetTime(); + /* Function already checks whether 'api' feature is enabled. */ + Endpoint::Ptr myEndpoint = Endpoint::GetLocalEndpoint(); + for (const Notification::Ptr& notification : ConfigType::GetObjectsByType()) { if (!notification->IsActive()) continue; String notificationName = notification->GetName(); - if (notification->IsPaused() && GetEnableHA()) { + /* Skip notification if paused, in a cluster setup & HA feature is enabled. */ + if (notification->IsPaused() && myEndpoint && GetEnableHA()) { Log(LogNotice, "NotificationComponent") << "Reminder notification '" << notificationName << "': HA cluster active, this endpoint does not have the authority (paused=true). Skipping."; continue; -- 2.40.0