mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Fixed bug that RedisSentinel
can't support empty password. (#5199)
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
parent
972b9d0a9a
commit
67fec55758
@ -164,3 +164,4 @@ composer analyse
|
||||
- [#5100](https://github.com/hyperf/hyperf/pull/5100) Fixed bug that the tag `continue` cannot work when using `view-engine`.
|
||||
- [#5121](https://github.com/hyperf/hyperf/pull/5121) Fixed bug that the SQL is not valid but the correct error message cannot be obtained when using `pgsql`.
|
||||
- [#5132](https://github.com/hyperf/hyperf/pull/5132) Fixed bug that the exit code of command does not work when the exception code isn't int.
|
||||
- [#5199](https://github.com/hyperf/hyperf/pull/5199) Fixed bug that `RedisSentinel` can't support empty password.
|
||||
|
@ -13,7 +13,6 @@ namespace Hyperf\AsyncQueue\Process;
|
||||
|
||||
use Hyperf\AsyncQueue\Driver\DriverFactory;
|
||||
use Hyperf\AsyncQueue\Driver\DriverInterface;
|
||||
use Hyperf\Contract\StdoutLoggerInterface;
|
||||
use Hyperf\Process\AbstractProcess;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
|
@ -30,7 +30,7 @@ return [
|
||||
'nodes' => explode(';', env('REDIS_SENTINEL_NODE', '')),
|
||||
'persistent' => '',
|
||||
'read_timeout' => 0,
|
||||
'auth' => null,
|
||||
'auth' => env('REDIS_SENTINEL_PASSWORD', ''),
|
||||
],
|
||||
'pool' => [
|
||||
'min_connections' => 1,
|
||||
|
@ -212,6 +212,13 @@ class RedisConnection extends BaseConnection implements ConnectionInterface
|
||||
$readTimeout = $this->config['sentinel']['read_timeout'] ?? 0;
|
||||
$masterName = $this->config['sentinel']['master_name'] ?? '';
|
||||
$auth = $this->config['sentinel']['auth'] ?? null;
|
||||
// fixes bug for phpredis
|
||||
// https://github.com/phpredis/phpredis/issues/2098
|
||||
$extendConfig = [];
|
||||
if (! empty($auth)) {
|
||||
$extendConfig[] = $auth;
|
||||
}
|
||||
|
||||
shuffle($nodes);
|
||||
|
||||
$host = null;
|
||||
@ -226,7 +233,7 @@ class RedisConnection extends BaseConnection implements ConnectionInterface
|
||||
$persistent,
|
||||
$retryInterval,
|
||||
$readTimeout,
|
||||
$auth
|
||||
...$extendConfig
|
||||
);
|
||||
$masterInfo = $sentinel->getMasterAddrByName($masterName);
|
||||
if (is_array($masterInfo) && count($masterInfo) >= 2) {
|
||||
@ -266,7 +273,7 @@ class RedisConnection extends BaseConnection implements ConnectionInterface
|
||||
{
|
||||
$parameters = [
|
||||
$config['host'] ?? '',
|
||||
$config['port'] ?? 6379,
|
||||
(int) ($config['port'] ?? 6379),
|
||||
$config['timeout'] ?? 0.0,
|
||||
$config['reserved'] ?? null,
|
||||
$config['retry_interval'] ?? 0,
|
||||
|
Loading…
Reference in New Issue
Block a user