From 372cf07bc4ca2ed369f35d0a34098b79dcbfaf59 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 14 Dec 2015 10:33:43 +0100 Subject: [PATCH] Clean up the FinishAsyncQueries code a bit refs #8714 --- lib/db_ido/dbevents.cpp | 2 -- lib/db_ido_mysql/idomysqlconnection.cpp | 14 +++----------- lib/db_ido_mysql/idomysqlconnection.hpp | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp index a763b65b5..514a65531 100644 --- a/lib/db_ido/dbevents.cpp +++ b/lib/db_ido/dbevents.cpp @@ -117,8 +117,6 @@ void DbEvents::NextCheckChangedHandler(const Checkable::Ptr& checkable) else query1.WhereCriteria->Set("host_object_id", host); - query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */ - DbObject::OnQuery(query1); } diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index dca7df260..7ed9b1d6e 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -139,7 +139,7 @@ void IdoMysqlConnection::TxTimerHandler(void) void IdoMysqlConnection::NewTransaction(void) { m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalNewTransaction, this), PriorityHigh); - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::FinishAsyncQueries, this, true), PriorityHigh); + m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::FinishAsyncQueries, this), PriorityHigh); } void IdoMysqlConnection::InternalNewTransaction(void) @@ -405,18 +405,10 @@ void IdoMysqlConnection::AsyncQuery(const String& query, const boost::function 500) - FinishAsyncQueries(true); - else - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::FinishAsyncQueries, this, false), PriorityLow); } -void IdoMysqlConnection::FinishAsyncQueries(bool force) +void IdoMysqlConnection::FinishAsyncQueries(void) { - if (m_AsyncQueries.size() < 10 && !force) - return; - std::vector queries; m_AsyncQueries.swap(queries); @@ -515,7 +507,7 @@ IdoMysqlResult IdoMysqlConnection::Query(const String& query) AssertOnWorkQueue(); /* finish all async queries to maintain the right order for queries */ - FinishAsyncQueries(true); + FinishAsyncQueries(); Log(LogDebug, "IdoMysqlConnection") << "Query: " << query; diff --git a/lib/db_ido_mysql/idomysqlconnection.hpp b/lib/db_ido_mysql/idomysqlconnection.hpp index 684c73b98..35c50ad0f 100644 --- a/lib/db_ido_mysql/idomysqlconnection.hpp +++ b/lib/db_ido_mysql/idomysqlconnection.hpp @@ -90,7 +90,7 @@ private: void DiscardRows(const IdoMysqlResult& result); void AsyncQuery(const String& query, const IdoAsyncCallback& callback = IdoAsyncCallback()); - void FinishAsyncQueries(bool force = false); + void FinishAsyncQueries(void); bool FieldToEscapedString(const String& key, const Value& value, Value *result); void InternalActivateObject(const DbObject::Ptr& dbobj);