Skip to content

Commit a5b817d

Browse files
authored
Merge pull request #99 from ywy2090/feature-milestone2-gateway
fix mpc task not execute bug
2 parents 77c138f + 02d5d90 commit a5b817d

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

cpp/wedpr-computing/ppc-mpc/src/MPCService.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -347,26 +347,31 @@ void MPCService::asyncRunMpcRpc(Json::Value const& request, RespFunc func)
347347
{
348348
response["code"] = MPC_SUCCESS;
349349
response["message"] = "success";
350+
351+
MPC_LOG(INFO) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc submit job successfully")
352+
<< LOG_KV("request", request.toStyledString())
353+
<< LOG_KV("response", response.toStyledString());
354+
355+
// async run mpc job
356+
m_threadPool->enqueue([self = weak_from_this(), jobInfo]() {
357+
auto service = self.lock();
358+
if (!service)
359+
{
360+
MPC_LOG(ERROR) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc service is null");
361+
return;
362+
}
363+
service->runMpcRpcByJobInfo(jobInfo);
364+
});
350365
}
351366
else
352367
{
353368
response["code"] = MPC_DUPLICATED;
354369
response["message"] = "duplicated submit job";
355-
}
356370

357-
MPC_LOG(INFO) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc submit job successfully")
371+
MPC_LOG(INFO) << LOG_DESC("[MPCService][asyncRunMpcRpc]") << LOG_DESC("async run mpc duplicated submit job")
358372
<< LOG_KV("request", request.toStyledString())
359373
<< LOG_KV("response", response.toStyledString());
360-
361-
// async run mpc job
362-
m_threadPool->enqueue([self = weak_from_this(), jobInfo]() {
363-
auto service = self.lock();
364-
if (!service)
365-
{
366-
return;
367-
}
368-
service->runMpcRpcByJobInfo(jobInfo);
369-
});
374+
}
370375
}
371376
catch (const std::exception& e)
372377
{

cpp/wedpr-computing/ppc-mpc/src/MPCService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
namespace ppc::mpc
3636
{
37-
class MPCService: std::enable_shared_from_this<MPCService>
37+
class MPCService: public std::enable_shared_from_this<MPCService>
3838
{
3939
public:
4040
using Ptr = std::shared_ptr<MPCService>;

0 commit comments

Comments
 (0)