]> granicus.if.org Git - icinga2/commitdiff
Make sure new comments/downtimes are added to the ID cache right away.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 11 Jul 2013 06:58:11 +0000 (08:58 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 11 Jul 2013 06:58:11 +0000 (08:58 +0200)
components/livestatus/commentstable.cpp
components/livestatus/downtimestable.cpp
lib/icinga/service-comment.cpp
lib/icinga/service-downtime.cpp

index 05c077bf95c5898b59099687be62153e0993eb71..f551d180e84df3cf7cfc62117366beba51f0a704 100644 (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);
                }
        }
 }
index f8e6650c9b789427bf634ccdfc82b34c2af35e8d..2222f647b5b1e8ed8d890a20e2db647d2e0f2760 100644 (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);
                }
        }
 }
index 972b71c8da166545ad7f4622d7b8d526ab9301c9..46fe4f35a61aa885066f9345e350caf69205f0b8 100644 (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;
 }
 
index c40ef94ce2e7cc847c7a8cad6febe188dd98eafa..87059158a9996c96e3710df81c6ddc2bd6624646 100644 (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;
 }