Skip to content

Commit

Permalink
remove parameter bolt_thread_num
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcui committed Jan 30, 2024
1 parent d4f6030 commit 5f5dc40
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
4 changes: 0 additions & 4 deletions src/core/global_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ std::map<std::string, std::string> 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;
}

Expand Down Expand Up @@ -211,7 +210,6 @@ fma_common::Configuration lgraph::GlobalConfig::InitConfig

// bolt
bolt_port = 0;
bolt_thread_num = 10;

// parse options
fma_common::Configuration argparser;
Expand Down Expand Up @@ -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;
}
1 change: 0 additions & 1 deletion src/core/global_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ struct BasicConfigs {
bool enable_realtime_count{};
// bolt
int bolt_port = 0;
int bolt_thread_num = 10;
};

template <typename T>
Expand Down
9 changes: 1 addition & 8 deletions src/server/bolt_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,10 @@ boost::asio::io_service workers;
static boost::asio::io_service listener(BOOST_ASIO_CONCURRENCY_HINT_UNSAFE);
extern std::function<void(bolt::BoltConnection &conn, bolt::BoltMsg msg,
std::vector<std::any> 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<bool> promise;
std::future<bool> future = promise.get_future();
threads_.emplace_back([this, &promise](){
Expand Down
3 changes: 1 addition & 2 deletions src/server/bolt_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -39,7 +39,6 @@ class BoltServer final {
BoltServer() = default;
lgraph::StateMachine* sm_ = nullptr;
int port_ = 0;
int workerNum_ = 0;
std::vector<std::thread> threads_;
bool stopped_ = false;
};
Expand Down
3 changes: 1 addition & 2 deletions src/server/lgraph_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 5f5dc40

Please sign in to comment.