From 5f5dc407c4b2ff5e47e76d9f39e134cf04e0c910 Mon Sep 17 00:00:00 2001 From: Wang Zhiyong Date: Tue, 30 Jan 2024 12:22:59 +0000 Subject: [PATCH] remove parameter `bolt_thread_num` --- src/core/global_config.cpp | 4 ---- src/core/global_config.h | 1 - src/server/bolt_server.cpp | 9 +-------- src/server/bolt_server.h | 3 +-- src/server/lgraph_server.cpp | 3 +-- 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/core/global_config.cpp b/src/core/global_config.cpp index a3aec9e988..3132b8065b 100644 --- a/src/core/global_config.cpp +++ b/src/core/global_config.cpp @@ -59,7 +59,6 @@ std::map lgraph::GlobalConfig::FormatAsOptions() const AddOption(options, "Bootstrap Role", ha_bootstrap_role); } AddOption(options, "bolt_port", bolt_port); - AddOption(options, "bolt_thread_num", bolt_thread_num); return options; } @@ -211,7 +210,6 @@ fma_common::Configuration lgraph::GlobalConfig::InitConfig // bolt bolt_port = 0; - bolt_thread_num = 10; // parse options fma_common::Configuration argparser; @@ -319,7 +317,5 @@ fma_common::Configuration lgraph::GlobalConfig::InitConfig .Comment("Node is witness (donot have data & can not apply request) or not."); argparser.Add(bolt_port, "bolt_port", true) .Comment("Bolt protocol port."); - argparser.Add(bolt_thread_num, "bolt_thread_num", true) - .Comment("bolt thread pool size."); return argparser; } diff --git a/src/core/global_config.h b/src/core/global_config.h index 2f281736f5..fab328c25a 100644 --- a/src/core/global_config.h +++ b/src/core/global_config.h @@ -128,7 +128,6 @@ struct BasicConfigs { bool enable_realtime_count{}; // bolt int bolt_port = 0; - int bolt_thread_num = 10; }; template diff --git a/src/server/bolt_server.cpp b/src/server/bolt_server.cpp index dd3c2c7d28..c5fad3f08a 100644 --- a/src/server/bolt_server.cpp +++ b/src/server/bolt_server.cpp @@ -22,17 +22,10 @@ boost::asio::io_service workers; static boost::asio::io_service listener(BOOST_ASIO_CONCURRENCY_HINT_UNSAFE); extern std::function fields)> BoltHandler; -bool BoltServer::Start(lgraph::StateMachine* sm, int port, int workerNum) { +bool BoltServer::Start(lgraph::StateMachine* sm, int port) { sm_ = sm; port_ = port; - workerNum_ = workerNum; bolt::MarkersInit(); - for (int i = 0; i < workerNum_; i++) { - threads_.emplace_back([](){ - boost::asio::io_service::work holder(workers); - workers.run(); - }); - } std::promise promise; std::future future = promise.get_future(); threads_.emplace_back([this, &promise](){ diff --git a/src/server/bolt_server.h b/src/server/bolt_server.h index 741a71bfcf..63db1b2a97 100644 --- a/src/server/bolt_server.h +++ b/src/server/bolt_server.h @@ -29,7 +29,7 @@ class BoltServer final { } DISABLE_COPY(BoltServer); DISABLE_MOVE(BoltServer); - bool Start(lgraph::StateMachine* sm, int port, int workerNum); + bool Start(lgraph::StateMachine* sm, int port); void Stop(); ~BoltServer() {Stop();} lgraph::StateMachine* StateMachine() { @@ -39,7 +39,6 @@ class BoltServer final { BoltServer() = default; lgraph::StateMachine* sm_ = nullptr; int port_ = 0; - int workerNum_ = 0; std::vector threads_; bool stopped_ = false; }; diff --git a/src/server/lgraph_server.cpp b/src/server/lgraph_server.cpp index 858cf7f1a7..5ffb4f9b5a 100644 --- a/src/server/lgraph_server.cpp +++ b/src/server/lgraph_server.cpp @@ -276,8 +276,7 @@ int LGraphServer::Start() { if (config_->bolt_port > 0) { if (!bolt::BoltServer::Instance().Start(state_machine_.get(), - config_->bolt_port, - config_->bolt_thread_num)) { + config_->bolt_port)) { return -1; } }