mirror of
https://github.com/predis/predis.git
synced 2026-08-27 18:51:07 +00:00
Swap params order in redis-sentinel constructor.
This commit is contained in:
@@ -42,7 +42,7 @@ class ReplicationOption implements OptionInterface
|
||||
|
||||
if ($value === 'sentinel') {
|
||||
return function ($sentinels, $options) {
|
||||
return new SentinelReplication($sentinels, $options->service, $options->connections);
|
||||
return new SentinelReplication($options->service, $sentinels, $options->connections);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -101,14 +101,14 @@ class SentinelReplication implements ReplicationInterface
|
||||
protected $updateSentinels = false;
|
||||
|
||||
/**
|
||||
* @param array $sentinels Sentinel servers connection parameters.
|
||||
* @param string $service Name of the service for autodiscovery.
|
||||
* @param array $sentinels Sentinel servers connection parameters.
|
||||
* @param ConnectionFactoryInterface $connectionFactory Connection factory instance.
|
||||
* @param ReplicationStrategy $strategy Replication strategy instance.
|
||||
*/
|
||||
public function __construct(
|
||||
array $sentinels,
|
||||
$service,
|
||||
array $sentinels,
|
||||
ConnectionFactoryInterface $connectionFactory,
|
||||
ReplicationStrategy $strategy = null
|
||||
) {
|
||||
|
||||
@@ -1040,7 +1040,7 @@ class SentinelReplicationTest extends PredisTestCase
|
||||
$factory = new Connection\Factory();
|
||||
|
||||
$replication = new SentinelReplication(
|
||||
array('tcp://127.0.0.1:5381?alias=sentinel1'), 'svc', $factory, $strategy
|
||||
'svc', array('tcp://127.0.0.1:5381?alias=sentinel1'), $factory, $strategy
|
||||
);
|
||||
|
||||
$this->assertSame($strategy, $replication->getReplicationStrategy());
|
||||
@@ -1060,7 +1060,7 @@ class SentinelReplicationTest extends PredisTestCase
|
||||
$strategy = new Replication\ReplicationStrategy();
|
||||
$factory = new Connection\Factory();
|
||||
|
||||
$replication = new SentinelReplication(array($sentinel1), 'svc', $factory, $strategy);
|
||||
$replication = new SentinelReplication('svc', array($sentinel1), $factory, $strategy);
|
||||
|
||||
$replication->add($master);
|
||||
$replication->add($slave1);
|
||||
@@ -1091,7 +1091,7 @@ class SentinelReplicationTest extends PredisTestCase
|
||||
{
|
||||
$factory = $factory ?: new Connection\Factory();
|
||||
|
||||
$replication = new SentinelReplication($sentinels, $service, $factory);
|
||||
$replication = new SentinelReplication($service, $sentinels, $factory);
|
||||
$replication->setRetryWait(0);
|
||||
|
||||
return $replication;
|
||||
|
||||
Reference in New Issue
Block a user