Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mpc task not execute bug #99

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions cpp/wedpr-computing/ppc-mpc/src/MPCService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/wedpr-computing/ppc-mpc/src/MPCService.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

namespace ppc::mpc
{
class MPCService: std::enable_shared_from_this<MPCService>
class MPCService: public std::enable_shared_from_this<MPCService>
{
public:
using Ptr = std::shared_ptr<MPCService>;
Expand Down
Loading