Merge branch 'master' into closure

This commit is contained in:
谷溪 2020-04-29 21:39:13 +08:00 committed by GitHub
commit 15a392903b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 14 deletions

View File

@ -1,8 +1,17 @@
# v1.1.28 - TBD
## Added
- [#1645](https://github.com/hyperf/hyperf/pull/1645) Added parameter injection support for closure route.
## Fixed
- [#1639](https://github.com/hyperf/hyperf/pull/1639) Fixed bug that the unhealthy node will be got from `consul`.
## Optimized
- [#1636](https://github.com/hyperf/hyperf/pull/1636) Optimized `co-phpunit` do not broken in coroutine environment, when cases failed.
# v1.1.27 - 2020-04-23
## Added

View File

@ -1,6 +1,8 @@
#!/usr/bin/env php
<?php
\Swoole\Coroutine\Run(function () {
$code = 0;
\Swoole\Coroutine\Run(function () use (&$code) {
if (version_compare('7.1.0', PHP_VERSION, '>')) {
fwrite(
STDERR,
@ -51,8 +53,8 @@
require PHPUNIT_COMPOSER_INSTALL;
$code = PHPUnit\TextUI\Command::main(false);
if ($code > 0) {
exit($code);
}
});
swoole_event_wait();
exit($code);

View File

@ -230,14 +230,19 @@ abstract class AbstractServiceClient
$services = $health->service($this->serviceName)->json();
$nodes = [];
foreach ($services as $node) {
$passing = false;
$passing = true;
$service = $node['Service'] ?? [];
$checks = $node['Checks'] ?? [];
if (isset($service['Meta']['Protocol']) && $this->protocol !== $service['Meta']['Protocol']) {
// The node is invalid, if the protocol is not equal with the client's protocol.
continue;
}
foreach ($checks as $check) {
$status = $check['Status'] ?? false;
if ($status === 'passing' && $this->protocol === $service['Meta']['Protocol']) {
$passing = true;
if ($status !== 'passing') {
$passing = false;
}
}

View File

@ -1,6 +1,8 @@
#!/usr/bin/env php
<?php
\Swoole\Coroutine::create(function () {
$code = 0;
\Swoole\Coroutine::create(function () use (&$code) {
if (version_compare('7.1.0', PHP_VERSION, '>')) {
fwrite(
STDERR,
@ -58,9 +60,8 @@
require PHPUNIT_COMPOSER_INSTALL;
$code = PHPUnit\TextUI\Command::main(false);
if ($code > 0) {
exit($code);
}
swoole_event_exit();
});
swoole_event_wait();
exit($code);