Skip to content

Commit

Permalink
优化响应结果判断
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Dec 25, 2019
1 parent a71fccc commit fa2376a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/grpc/Client/GrpcClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use Imi\Bean\BeanFactory;
use Imi\Grpc\Parser;
use Imi\Log\Log;
use Imi\Rpc\Client\IService;
use Imi\Rpc\Client\IRpcClient;
use Imi\Util\Uri;
Expand Down Expand Up @@ -175,7 +176,12 @@ public function recv($responseClass, $streamId = -1, $timeout = null)
{
throw new \RuntimeException(sprintf('gRPC recv() failed, errCode:%s, errorMsg:%s', $result->getErrno(), $result->getError()));
}
return Parser::deserializeMessage([$responseClass, 'decode'], $result->body());
$return = Parser::deserializeMessage([$responseClass, 'decode'], $result->body());
if(!$return)
{
Log::debug(sprintf('GrpcClient deserializeMessage failed. statusCode: %s', $result->getStatusCode()));
}
return $return;
}

/**
Expand Down

0 comments on commit fa2376a

Please sign in to comment.