Make sure new comments/downtimes are added to the ID cache right away.

This commit is contained in:
Gunnar Beutner 2013-07-11 08:58:11 +02:00
parent 033389d243
commit 540e63c157
4 changed files with 14 additions and 2 deletions

View File

@ -69,7 +69,8 @@ void CommentsTable::FetchRows(const AddRowFunction& addRowFn)
String id;
BOOST_FOREACH(boost::tie(id, boost::tuples::ignore), comments) {
addRowFn(id);
if (Service::GetOwnerByCommentID(id) == service)
addRowFn(id);
}
}
}

View File

@ -69,7 +69,8 @@ void DowntimesTable::FetchRows(const AddRowFunction& addRowFn)
String id;
BOOST_FOREACH(boost::tie(id, boost::tuples::ignore), downtimes) {
addRowFn(id);
if (Service::GetOwnerByDowntimeID(id) == service)
addRowFn(id);
}
}
}

View File

@ -90,6 +90,11 @@ String Service::AddComment(CommentType entryType, const String& author,
Touch("comments");
}
{
boost::mutex::scoped_lock lock(l_CommentMutex);
l_CommentsCache[id] = GetSelf();
}
return id;
}

View File

@ -126,6 +126,11 @@ String Service::AddDowntime(const String& author, const String& comment,
(void) AddComment(CommentDowntime, author, comment, endTime);
{
boost::mutex::scoped_lock lock(l_DowntimeMutex);
l_DowntimesCache[id] = GetSelf();
}
return id;
}