mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 15:14:07 +02:00
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);
|
ObjectLock olock(this);
|
||||||
|
|
||||||
|
UpdateNotificationNumber();
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
SetLastNotification(now);
|
SetLastNotification(now);
|
||||||
|
|
||||||
if (type == NotificationProblem)
|
if (type == NotificationProblem)
|
||||||
SetLastProblemNotification(now);
|
SetLastProblemNotification(now);
|
||||||
}
|
}
|
||||||
@ -365,12 +365,6 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
|
|||||||
std::copy(members.begin(), members.end(), std::inserter(allUsers, allUsers.begin()));
|
std::copy(members.begin(), members.end(), std::inserter(allUsers, allUsers.begin()));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(this);
|
|
||||||
UpdateNotificationNumber();
|
|
||||||
SetLastNotification(Utility::GetTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::set<User::Ptr> allNotifiedUsers;
|
std::set<User::Ptr> allNotifiedUsers;
|
||||||
Array::Ptr notifiedUsers = GetNotifiedUsers();
|
Array::Ptr notifiedUsers = GetNotifiedUsers();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user