Skip to content

Commit 5495132

Browse files
committed
fix model can't send message when some gateway down
1 parent 7e0cf85 commit 5495132

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cpp/wedpr-protocol/grpc/client/GrpcClient.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ bcos::Error::Ptr GrpcClient::broadCast(
7575
std::function<bcos::Error::Ptr(ChannelInfo const& channel)> callback)
7676
{
7777
auto result = std::make_shared<bcos::Error>(0, "");
78+
int successCount = 0;
7879
for (auto const& channel : m_broadcastChannels)
7980
{
8081
try
@@ -91,6 +92,10 @@ bcos::Error::Ptr GrpcClient::broadCast(
9192
result->setErrorCode(error->errorCode());
9293
result->setErrorMessage(result->errorMessage() + error->errorMessage() + "; ");
9394
}
95+
else
96+
{
97+
successCount++;
98+
}
9499
}
95100
catch (std::exception const& e)
96101
{
@@ -99,5 +104,10 @@ bcos::Error::Ptr GrpcClient::broadCast(
99104
<< LOG_KV("error", boost::diagnostic_information(e));
100105
}
101106
}
107+
// at least one success
108+
if (successCount > 0)
109+
{
110+
return std::make_shared<bcos::Error>(0, "success");
111+
}
102112
return result;
103113
}

0 commit comments

Comments
 (0)