mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-05 13:18:22 +08:00
Optimized code.
This commit is contained in:
parent
ea65795790
commit
7c27a5ac65
@ -58,7 +58,8 @@ class CoroutineHandler
|
||||
if (! empty($settings)) {
|
||||
$client->set($settings);
|
||||
}
|
||||
$client->execute($path);
|
||||
$this->execute($client, $path);
|
||||
|
||||
$ex = $this->checkStatusCode($client, $request);
|
||||
if ($ex !== true) {
|
||||
return \GuzzleHttp\Promise\rejection_for($ex);
|
||||
@ -69,6 +70,11 @@ class CoroutineHandler
|
||||
return new FulfilledPromise($response);
|
||||
}
|
||||
|
||||
protected function execute(Client $client, $path)
|
||||
{
|
||||
$client->execute($path);
|
||||
}
|
||||
|
||||
protected function initHeaders(Client $client, RequestInterface $request, $options)
|
||||
{
|
||||
$headers = [];
|
||||
|
@ -71,7 +71,7 @@ class PoolHandler extends CoroutineHandler
|
||||
if (! empty($settings)) {
|
||||
$client->set($settings);
|
||||
}
|
||||
$client->execute($path);
|
||||
$this->execute($client, $path);
|
||||
|
||||
$ex = $this->checkStatusCode($client, $request);
|
||||
if ($ex !== true) {
|
||||
|
@ -63,7 +63,7 @@ class CoroutineHandler
|
||||
}
|
||||
|
||||
$btime = microtime(true);
|
||||
$client->execute($path);
|
||||
$this->execute($client, $path);
|
||||
|
||||
$ex = $this->checkStatusCode($client, $request);
|
||||
if ($ex !== true) {
|
||||
@ -78,6 +78,11 @@ class CoroutineHandler
|
||||
return $this->getResponse($client, $btime, $effectiveUrl);
|
||||
}
|
||||
|
||||
protected function execute(Client $client, $path)
|
||||
{
|
||||
$client->execute($path);
|
||||
}
|
||||
|
||||
protected function getSettings($options): array
|
||||
{
|
||||
$settings = [];
|
||||
|
@ -68,7 +68,7 @@ class PoolHandler extends CoroutineHandler
|
||||
}
|
||||
|
||||
$btime = microtime(true);
|
||||
$client->execute($path);
|
||||
$this->execute($client, $path);
|
||||
|
||||
$ex = $this->checkStatusCode($client, $request);
|
||||
if ($ex !== true) {
|
||||
|
Loading…
Reference in New Issue
Block a user