[icinga-checkins] icinga.org: icinga2/master: Optimize two ObjectLocks into one in Notification:: BeginExecuteNotification method

git at icinga.org git at icinga.org
Tue Aug 2 18:41:51 CEST 2016


Module: icinga2
Branch: master
Commit: 3f0b6ec003284de42320769f9d6268de3eeeba48
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=3f0b6ec003284de42320769f9d6268de3eeeba48

Author: Conrad Clement <cclement at printeron.com>
Date:   Wed Jul 20 14:30:05 2016 -0400

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 <michael.friedrich at netways.de>

---

 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 06413a4..804eb23 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<User::Ptr> allNotifiedUsers;
 	Array::Ptr notifiedUsers = GetNotifiedUsers();
 



More information about the icinga-checkins mailing list