From 1600cb98fea993f0bd1b5c4151ccb69aaf79a48b Mon Sep 17 00:00:00 2001 From: an-tao <20741618@qq.com> Date: Mon, 18 Feb 2019 11:10:30 +0800 Subject: [PATCH] Modify the number of event loops in the DbClientImpl class --- orm_lib/src/DbClientImpl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orm_lib/src/DbClientImpl.cc b/orm_lib/src/DbClientImpl.cc index 92d19c31..e56ca140 100644 --- a/orm_lib/src/DbClientImpl.cc +++ b/orm_lib/src/DbClientImpl.cc @@ -44,7 +44,7 @@ using namespace drogon::orm; DbClientImpl::DbClientImpl(const std::string &connInfo, const size_t connNum, ClientType type) : _connInfo(connInfo), _connectNum(connNum), - _loops(type == ClientType::Sqlite3 ? 1 : (connNum / 100 > 0 ? connNum / 100 : 1), "DbLoop") + _loops(type == ClientType::Sqlite3 ? 1 : (connNum < std::thread::hardware_concurrency() ? connNum : std::thread::hardware_concurrency()), "DbLoop") { _type = type; LOG_TRACE << "type=" << (int)type;