mirror of https://github.com/Icinga/icinga2.git
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@netways.de>
This commit is contained in:
parent
1ff6939f90
commit
3f0b6ec003
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue