mirror of https://github.com/Icinga/icinga2.git
parent
0d64a8fd32
commit
e13a6ac23d
|
@ -82,9 +82,13 @@ String Service::AddComment(CommentType entryType, const String& author,
|
||||||
}
|
}
|
||||||
|
|
||||||
String id = Utility::NewUniqueID();
|
String id = Utility::NewUniqueID();
|
||||||
comments->Set(id, comment);
|
|
||||||
|
|
||||||
Touch("comments");
|
{
|
||||||
|
ObjectLock olock(this);
|
||||||
|
|
||||||
|
comments->Set(id, comment);
|
||||||
|
Touch("comments");
|
||||||
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +109,8 @@ void Service::RemoveComment(const String& id)
|
||||||
Dictionary::Ptr comments = owner->GetComments();
|
Dictionary::Ptr comments = owner->GetComments();
|
||||||
|
|
||||||
if (comments) {
|
if (comments) {
|
||||||
|
ObjectLock olock(owner);
|
||||||
|
|
||||||
comments->Remove(id);
|
comments->Remove(id);
|
||||||
owner->Touch("comments");
|
owner->Touch("comments");
|
||||||
}
|
}
|
||||||
|
@ -208,7 +214,11 @@ void Service::RefreshCommentsCache(void)
|
||||||
|
|
||||||
legacy_id = l_NextCommentID++;
|
legacy_id = l_NextCommentID++;
|
||||||
comment->Set("legacy_id", legacy_id);
|
comment->Set("legacy_id", legacy_id);
|
||||||
service->Touch("comments");
|
|
||||||
|
{
|
||||||
|
ObjectLock olock(service);
|
||||||
|
service->Touch("comments");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newLegacyCommentsCache[legacy_id] = id;
|
newLegacyCommentsCache[legacy_id] = id;
|
||||||
|
@ -254,6 +264,7 @@ void Service::RemoveExpiredComments(void)
|
||||||
comments->Remove(id);
|
comments->Remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjectLock olock(this);
|
||||||
Touch("comments");
|
Touch("comments");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,8 +79,12 @@ String Service::AddDowntime(const String& author, const String& comment,
|
||||||
Dictionary::Ptr otherDowntimes = otherOwner->Get("downtimes");
|
Dictionary::Ptr otherDowntimes = otherOwner->Get("downtimes");
|
||||||
Dictionary::Ptr otherDowntime = otherDowntimes->Get(triggeredBy);
|
Dictionary::Ptr otherDowntime = otherDowntimes->Get(triggeredBy);
|
||||||
Dictionary::Ptr triggers = otherDowntime->Get("triggers");
|
Dictionary::Ptr triggers = otherDowntime->Get("triggers");
|
||||||
triggers->Set(triggeredBy, triggeredBy);
|
|
||||||
otherOwner->Touch("downtimes");
|
{
|
||||||
|
ObjectLock olock(otherOwner);
|
||||||
|
triggers->Set(triggeredBy, triggeredBy);
|
||||||
|
otherOwner->Touch("downtimes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr downtimes;
|
Dictionary::Ptr downtimes;
|
||||||
|
@ -99,7 +103,12 @@ String Service::AddDowntime(const String& author, const String& comment,
|
||||||
String id = Utility::NewUniqueID();
|
String id = Utility::NewUniqueID();
|
||||||
downtimes->Set(id, downtime);
|
downtimes->Set(id, downtime);
|
||||||
|
|
||||||
Touch("downtimes");
|
{
|
||||||
|
ObjectLock olock(this);
|
||||||
|
Touch("downtimes");
|
||||||
|
}
|
||||||
|
|
||||||
|
(void) AddComment(CommentDowntime, author, comment, endTime);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -116,8 +125,11 @@ void Service::RemoveDowntime(const String& id)
|
||||||
if (!downtimes)
|
if (!downtimes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
downtimes->Remove(id);
|
{
|
||||||
owner->Touch("downtimes");
|
ObjectLock olock(owner);
|
||||||
|
downtimes->Remove(id);
|
||||||
|
owner->Touch("downtimes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Service::TriggerDowntimes(void)
|
void Service::TriggerDowntimes(void)
|
||||||
|
|
Loading…
Reference in New Issue