Skip to content

Commit

Permalink
fix cpprest threadpool initialization exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcui committed Feb 11, 2025
1 parent 6706c7a commit bb9effb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/server/lgraph_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,10 @@ int LGraphServer::Start() {
#ifndef _WIN32
// set REST thread limit
if (config_->thread_limit != 0) {
static bool cpprest_threadpool_init = false;
if (!cpprest_threadpool_init) {
LOG_INFO() << "Init cpprest threadpool with thread " << config_->thread_limit;
// avoid to init threadpool twice, some test cases can cause this issue.
try {
crossplat::threadpool::initialize_with_threads(config_->thread_limit);
cpprest_threadpool_init = true;
} catch (const std::exception& e) {
LOG_WARN() << "failed to init cpprest threadpool, exception:" << e.what();
}
}
rpc_service_ = std::make_unique<RPCService>(state_machine_.get());
Expand Down

0 comments on commit bb9effb

Please sign in to comment.