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 :)
This commit is contained in:
Michael Friedrich 2019-04-03 13:50:21 +02:00
parent 5c3a9b77d7
commit 84019ba27a
1 changed files with 5 additions and 1 deletions

View File

@ -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<Notification>()) {
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;