[Fix #3931] Remove removed results correctly (#3938)

This commit is contained in:
Teddy Reed 2017-11-18 15:21:11 -08:00 committed by GitHub
parent 8e10156a1f
commit 523ad777a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,16 +127,17 @@ inline void launchQuery(const std::string& name, const ScheduledQuery& query) {
diff_results.added = std::move(sql.rows());
}
if (query.options.count("removed") && !query.options.at("removed")) {
diff_results.removed.clear();
}
if (diff_results.added.empty() && diff_results.removed.empty()) {
// No diff results or events to emit.
return;
}
VLOG(1) << "Found results for query: " << name;
item.results = diff_results;
if (query.options.count("removed") && !query.options.at("removed")) {
item.results.removed.clear();
}
item.results = std::move(diff_results);
status = logQueryLogItem(item);
if (!status.ok()) {