From 3f0b6ec003284de42320769f9d6268de3eeeba48 Mon Sep 17 00:00:00 2001 From: Conrad Clement Date: Wed, 20 Jul 2016 14:30:05 -0400 Subject: [PATCH] Optimize two ObjectLocks into one in Notification::BeginExecuteNotification method object is locked twice to update values of NotificationNumber, LastNotification and LastProblemNotification. LastNotificaiton is updated inside each ObjectLock merge two ObjectLocks into one and remove duplicate update fixes #12188 Signed-off-by: Michael Friedrich --- lib/icinga/notification.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 06413a4c5..804eb235c 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -348,9 +348,9 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe { ObjectLock olock(this); + UpdateNotificationNumber(); double now = Utility::GetTime(); SetLastNotification(now); - if (type == NotificationProblem) SetLastProblemNotification(now); } @@ -365,12 +365,6 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe std::copy(members.begin(), members.end(), std::inserter(allUsers, allUsers.begin())); } - { - ObjectLock olock(this); - UpdateNotificationNumber(); - SetLastNotification(Utility::GetTime()); - } - std::set allNotifiedUsers; Array::Ptr notifiedUsers = GetNotifiedUsers();