mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 19:58:22 +08:00
Merge branch 'master' of https://github.com/hyperf/hyperf into metric
This commit is contained in:
commit
e8ef6740e0
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,9 +1,19 @@
|
||||
# v1.1.8 - TBD
|
||||
|
||||
## Fixed
|
||||
|
||||
- [#1013](https://github.com/hyperf/hyperf/pull/1013) Fixed config of JsonRpcPoolTransporter merge failed.
|
||||
- [#1006](https://github.com/hyperf/hyperf/pull/1006) Fixed the order of properties of Model.
|
||||
|
||||
## Changed
|
||||
|
||||
- [#1021](https://github.com/hyperf/hyperf/pull/1021) Added default port to WebSocket client.
|
||||
|
||||
## Optimized
|
||||
|
||||
- [#1014](https://github.com/hyperf/hyperf/pull/1014) Optimized `Command:: execute` return value does not support null.
|
||||
- [#1022](https://github.com/hyperf/hyperf/pull/1022) Provided cleaner connection pool error message without implementation details.
|
||||
|
||||
# v1.1.7 - 2019-11-21
|
||||
|
||||
## Added
|
||||
|
@ -167,9 +167,14 @@ return [
|
||||
];
|
||||
```
|
||||
|
||||
## 发布组件配置
|
||||
|
||||
Hyperf 采用组件化设计,在添加一些组件进来骨架项目后,我们通常会需要为新添加的组件创建对应的配置文件,以满足对组件的使用。Hyperf 为组件提供了一个 `组件配置发布机制`,通过该机制,您只需通过一个 `vendor:publish` 命令即可将组件预设的配置文件模板发布到骨架项目中来。
|
||||
比如我们希望添加一个 `hyperf/foo` 组件 (该组件实际并不存在,仅示例) 以及该组件对应的配置文件,在执行 `composer require hyperf/foo` 安装之后,您可通过执行 `php bin/hyperf.php vendor:publish hyperf/foo` 来将组件预设的配置文件,发布到骨架项目的 `config/autoload` 文件夹内,具体要发布的内容,由组件来定义提供。
|
||||
|
||||
## 配置中心
|
||||
|
||||
Hyperf 为您提供了分布式系统的外部化配置支持,默认且仅适配了由携程开源的 [ctripcorp/apollo](https://github.com/ctripcorp/apollo),由 [hyper/config-apollo](https://github.com/hyperf/config-apollo) 组件提供功能支持。
|
||||
Hyperf 为您提供了分布式系统的外部化配置支持,目前支持由携程开源的 `Apollo`、阿里云 ACM 应用配置管理、ETCD 以及 Zookeeper 作为配置中心的支持。
|
||||
关于配置中心的使用细节我们由 [配置中心](zh/config-center.md) 章节来阐述。
|
||||
|
||||
|
||||
|
@ -398,7 +398,10 @@ abstract class Command extends SymfonyCommand
|
||||
}
|
||||
|
||||
$this->eventDispatcher->dispatch(new Event\FailToHandle($this, $exception));
|
||||
return $exception->getCode();
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
if ($this->coroutine && ! Coroutine::inCoroutine()) {
|
||||
|
@ -47,12 +47,10 @@ class MySqlGrammar extends Grammar
|
||||
|
||||
/**
|
||||
* Compile the query to determine the list of columns.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileColumnListing()
|
||||
public function compileColumnListing(): string
|
||||
{
|
||||
return 'select `column_name`, `data_type`, `column_comment` from information_schema.columns where `table_schema` = ? and `table_name` = ?';
|
||||
return 'select `column_name`, `data_type`, `column_comment` from information_schema.columns where `table_schema` = ? and `table_name` = ? order by ORDINAL_POSITION';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,6 +77,8 @@ abstract class GeneratorCommand extends Command
|
||||
file_put_contents($path, $this->buildClass($name));
|
||||
|
||||
$output->writeln(sprintf('<info>%s</info>', $name . ' created successfully.'));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -230,7 +232,6 @@ abstract class GeneratorCommand extends Command
|
||||
|
||||
/**
|
||||
* Get the custom config for generator.
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfig(): array
|
||||
{
|
||||
@ -247,7 +248,6 @@ abstract class GeneratorCommand extends Command
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getStub(): string;
|
||||
|
||||
@ -255,7 +255,6 @@ abstract class GeneratorCommand extends Command
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getDefaultNamespace(): string;
|
||||
}
|
||||
|
@ -47,5 +47,7 @@ class InfoCommand extends SymfonyCommand
|
||||
}
|
||||
$adapter = $this->info->get($type);
|
||||
$adapter->execute($input, $output);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class Request extends \Hyperf\HttpMessage\Base\Request implements ServerRequestI
|
||||
private $bodyParams;
|
||||
|
||||
/**
|
||||
* Load a swoole request, and transfer to a swoft request object.
|
||||
* Load a swoole request, and transfer to a psr-7 request object.
|
||||
*
|
||||
* @return \Hyperf\HttpMessage\Server\Request
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ class JsonRpcPoolTransporter implements TransporterInterface
|
||||
public function __construct(PoolFactory $factory, array $config = [])
|
||||
{
|
||||
$this->factory = $factory;
|
||||
$this->config = array_merge_recursive($this->config, $config);
|
||||
$this->config = array_replace_recursive($this->config, $config);
|
||||
}
|
||||
|
||||
public function send(string $data)
|
||||
@ -157,6 +157,11 @@ class JsonRpcPoolTransporter implements TransporterInterface
|
||||
return $this->nodes;
|
||||
}
|
||||
|
||||
public function getConfig(): array
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
private function getEof(): string
|
||||
{
|
||||
return $this->config['eof'] ?? "\r\n";
|
||||
|
39
src/json-rpc/tests/JsonRpcPoolTransporterTest.php
Normal file
39
src/json-rpc/tests/JsonRpcPoolTransporterTest.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://doc.hyperf.io
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
namespace HyperfTest\JsonRpc;
|
||||
|
||||
use Hyperf\JsonRpc\JsonRpcPoolTransporter;
|
||||
use Hyperf\JsonRpc\Pool\PoolFactory;
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class JsonRpcPoolTransporterTest extends TestCase
|
||||
{
|
||||
protected function tearDown()
|
||||
{
|
||||
Mockery::close();
|
||||
}
|
||||
|
||||
public function testJsonRpcPoolTransporterConfig()
|
||||
{
|
||||
$factory = Mockery::mock(PoolFactory::class);
|
||||
$transporter = new JsonRpcPoolTransporter($factory, ['pool' => ['min_connections' => 10]]);
|
||||
|
||||
$this->assertSame(10, $transporter->getConfig()['pool']['min_connections']);
|
||||
$this->assertSame(32, $transporter->getConfig()['pool']['max_connections']);
|
||||
}
|
||||
}
|
@ -133,7 +133,7 @@ abstract class Pool implements PoolInterface
|
||||
|
||||
$connection = $this->channel->pop($this->option->getWaitTimeout());
|
||||
if (! $connection instanceof ConnectionInterface) {
|
||||
throw new RuntimeException('Cannot pop the connection, pop timeout.');
|
||||
throw new RuntimeException('Connection pool exhausted. Cannot establish new connection before wait_timeout.');
|
||||
}
|
||||
return $connection;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user