mirror of
https://github.com/predis/predis.git
synced 2026-08-30 12:15:03 +00:00
Don't send AUTH and/or SELECT command after connecting to sentinels
This commit is contained in:
committed by
Daniele Alessandri
parent
4d58928efd
commit
d92f31dc66
@@ -239,9 +239,10 @@ class SentinelReplication implements ReplicationInterface
|
||||
}
|
||||
|
||||
if (is_array($parameters)) {
|
||||
// We unset "password" and "database" from user-supplied parameters
|
||||
// as they are not needed when connecting to sentinels.
|
||||
unset($parameters['database'], $parameters['password']);
|
||||
// We explicitly set "database" and "password" to null,
|
||||
// so that no AUTH and SELECT command is send to the sentinels.
|
||||
$parameters['database'] = null;
|
||||
$parameters['password'] = null;
|
||||
|
||||
if (!isset($parameters['timeout'])) {
|
||||
$parameters['timeout'] = $this->sentinelTimeout;
|
||||
|
||||
@@ -44,8 +44,7 @@ class SentinelReplicationTest extends PredisTestCase
|
||||
|
||||
$parameters = $replication->getSentinelConnection()->getParameters()->toArray();
|
||||
|
||||
$this->assertArrayNotHasKey('password', $parameters);
|
||||
$this->assertArrayNotHasKey('database', $parameters);
|
||||
$this->assertArraySubset(array('database' => null, 'password' => null), $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user