diff --git a/cpp/wedpr-computing/ppc-mpc/src/MPCService.cpp b/cpp/wedpr-computing/ppc-mpc/src/MPCService.cpp index b7138cb4..1bce96ee 100644 --- a/cpp/wedpr-computing/ppc-mpc/src/MPCService.cpp +++ b/cpp/wedpr-computing/ppc-mpc/src/MPCService.cpp @@ -347,26 +347,31 @@ void MPCService::asyncRunMpcRpc(Json::Value const& request, RespFunc func) { response["code"] = MPC_SUCCESS; response["message"] = "success"; + + MPC_LOG(INFO) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc submit job successfully") + << LOG_KV("request", request.toStyledString()) + << LOG_KV("response", response.toStyledString()); + + // async run mpc job + m_threadPool->enqueue([self = weak_from_this(), jobInfo]() { + auto service = self.lock(); + if (!service) + { + MPC_LOG(ERROR) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc service is null"); + return; + } + service->runMpcRpcByJobInfo(jobInfo); + }); } else { response["code"] = MPC_DUPLICATED; response["message"] = "duplicated submit job"; - } - MPC_LOG(INFO) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc submit job successfully") + MPC_LOG(INFO) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc duplicated submit job") << LOG_KV("request", request.toStyledString()) << LOG_KV("response", response.toStyledString()); - - // async run mpc job - m_threadPool->enqueue([self = weak_from_this(), jobInfo]() { - auto service = self.lock(); - if (!service) - { - return; - } - service->runMpcRpcByJobInfo(jobInfo); - }); + } } catch (const std::exception& e) { diff --git a/cpp/wedpr-computing/ppc-mpc/src/MPCService.h b/cpp/wedpr-computing/ppc-mpc/src/MPCService.h index ebc89d45..a91b0cfa 100644 --- a/cpp/wedpr-computing/ppc-mpc/src/MPCService.h +++ b/cpp/wedpr-computing/ppc-mpc/src/MPCService.h @@ -34,7 +34,7 @@ namespace ppc::mpc { -class MPCService: std::enable_shared_from_this +class MPCService: public std::enable_shared_from_this { public: using Ptr = std::shared_ptr;