From fad58e97072e988e9e0209a1adbaf1e3810c0b7f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 14 Feb 2019 15:40:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cpp/dbpool.cc | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/cpp/dbpool.cc b/cpp/dbpool.cc index 1c9690e..254173f 100644 --- a/cpp/dbpool.cc +++ b/cpp/dbpool.cc @@ -348,12 +348,6 @@ namespace f8 } } - AsyncQueryRequest* GetAsyncQueryRequest(long long seqid) - { - auto itr = async_query_hash.find(seqid); - return itr != async_query_hash.end() ? itr->second : nullptr; - } - void AsyncSqlOnOk(long long seqid, DataSet* data_set) { AsyncQueryRequest* request = GetAsyncQueryRequest(seqid); @@ -418,15 +412,26 @@ namespace f8 } a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10, a8::XParams() - .SetSender(this) - .SetParam1(p->context_id), + .SetSender(p->context_id) + .SetParam1(exec_async_query_msgid), [] (const a8::XParams& param) { - + MsgQueue::Instance()->PostMsg_r(param.param1, + a8::XParams() + .SetSender(param.sender) + .SetParam1(AQE_CONN_ERROR)); }, &p->timer_attacher.timer_list_); } + private: + + AsyncQueryRequest* GetAsyncQueryRequest(long long seqid) + { + auto itr = async_query_hash.find(seqid); + return itr != async_query_hash.end() ? itr->second : nullptr; + } + DBThread* GetDBThread(long long hash_code) { if (db_thread_pool.empty() || hash_code < 0) { @@ -436,10 +441,12 @@ namespace f8 } public: + unsigned short exec_async_query_msgid = 0; + + private: long long curr_seqid = 0; std::map async_query_hash; - unsigned short exec_async_query_msgid = 0; std::vector db_thread_pool; }; @@ -486,4 +493,5 @@ namespace f8 { impl_->InternalExecAsyncSql(1, conn_info, querystr, args, param, on_ok, on_error, hash_code); } + }