Skip to content

Commit 4ff096b

Browse files
fix redis config replace error (#2635)
* fix redis config error * update * update Co-authored-by: 李铭昕 <[email protected]>
1 parent 69f1a6e commit 4ff096b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/RedisConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class RedisConnection extends BaseConnection implements ConnectionInterface
6565
public function __construct(ContainerInterface $container, Pool $pool, array $config)
6666
{
6767
parent::__construct($container, $pool);
68-
$this->config = array_replace($this->config, $config);
68+
$this->config = array_replace_recursive($this->config, $config);
6969

7070
$this->reconnect();
7171
}
@@ -166,7 +166,7 @@ protected function createRedisCluster()
166166
try {
167167
$seeds = $this->config['cluster']['seeds'] ?? [];
168168
$name = $this->config['cluster']['name'] ?? null;
169-
$readTimeout = $this->config['cluster']['read_timeout'] ?? null;
169+
$readTimeout = $this->config['cluster']['read_timeout'] ?? 0.0;
170170
$persistent = $this->config['cluster']['persistent'] ?? false;
171171
$timeout = $this->config['timeout'] ?? null;
172172
$auth = $this->config['auth'] ?? null;

tests/RedisConnectionTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public function testRedisConnectionConfig()
4949
'cluster' => [
5050
'enable' => false,
5151
'name' => null,
52-
'seeds' => [],
52+
'seeds' => [
53+
'127.0.0.1:6379',
54+
],
5355
'read_timeout' => 0.0,
5456
'persistent' => false,
5557
],
@@ -128,6 +130,16 @@ private function getRedisPool()
128130
'heartbeat' => -1,
129131
'max_idle_time' => 1,
130132
],
133+
'cluster' => [
134+
'enable' => false,
135+
'name' => null,
136+
'seeds' => [
137+
'127.0.0.1:6379',
138+
],
139+
],
140+
'sentinel' => [
141+
'enable' => false,
142+
],
131143
],
132144
],
133145
]));

0 commit comments

Comments
 (0)