public function test()
{
$hostname = 'localhost:2223';
$client = new \Proto\BlacklistClient($hostname, [
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
]);
$request = new \Proto\MobileRequest();
$request->setMobiles([
13688889996,
13688889997,);
dump($client);
$resp = $client->WriteWhite($request)->wait();
dump($resp);
}
Cli模式下, 直接跑的代碼
<?php
include 'vendor/autoload.php';
$hostname = 'localhost:2223';
$client = new \Proto\BlacklistClient($hostname, [
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
]);
$request = new \Proto\MobileRequest();
$request->setMobiles([
13688889996,
13688889997,]);
list($response, $status) = $client->WriteBlack($request)->wait();
if ($status->code === \Grpc\STATUS_OK) {
dump($response);
}
Blacklist write b:{1561883092,1561883093,15618830982,15618830983}, w:{1361883092,1361883093,13618830982,13618830983}.
^ Proto\BlacklistClient^ {#380
-hostname: "localhost:2223"
-hostname_override: null
-channel: Grpc\Channel {#383}
-call_invoker: Grpc\DefaultCallInvoker^ {#386}
-update_metadata: null
}
[mutex.cc : 2417] RAW: Check w->waitp->cond == nullptr failed: Mutex::Fer while waiting on Condition
worker[webman:11067] exit with status 134
這里寫具體的系統(tǒng)環(huán)境相關(guān)信息
操作系統(tǒng)是Centos8, PHP版本7.4, PHP grpc擴(kuò)展是1.6.2.