File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
cpp/wedpr-transport/ppc-rpc/src Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,15 @@ void RpcMemory::cleanTask()
7272bcos::Error::Ptr RpcMemory::insertTask (protocol::Task::Ptr _task)
7373{
7474 WriteGuard l (x_tasks);
75- if (m_tasks.find (_task->id ()) != m_tasks.end ())
75+ auto it = m_tasks.find (_task->id ());
76+ if (it != m_tasks.end ())
7677 {
77- return std::make_shared<bcos::Error>(PPCRetCode::WRITE_RPC_STATUS_ERROR, " task exists" );
78+ auto taskResult = it->second .second ;
79+ // the task already exists case
80+ if (!taskResult || taskResult->status () == toString (TaskStatus::RUNNING))
81+ {
82+ return std::make_shared<bcos::Error>(PPCRetCode::WRITE_RPC_STATUS_ERROR, " task exists" );
83+ }
7884 }
7985 auto taskResult = std::make_shared<TaskResult>(_task->id ());
8086 taskResult->setStatus (toString (TaskStatus::RUNNING));
You can’t perform that action at this time.
0 commit comments