Skip to content

Commit

Permalink
Create cluster connection correctly for one host (#416)
Browse files Browse the repository at this point in the history
* Create cluster connection correctly

* Unset replication option if cluster option is defined for predis client
  • Loading branch information
linasm83 authored and curry684 committed May 9, 2018
1 parent 6b3d92f commit 5d8169e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DependencyInjection/SncRedisExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ protected function loadPredisClient(array $client, ContainerBuilder $container)
{
if (null === $client['options']['cluster']) {
unset($client['options']['cluster']);
} else {
unset($client['options']['replication']);
}

// predis connection parameters have been renamed in v0.8
Expand Down Expand Up @@ -207,7 +209,7 @@ protected function loadPredisClient(array $client, ContainerBuilder $container)
$clientDef = new Definition($container->getParameter('snc_redis.client.class'));
$clientDef->setPublic(true);
$clientDef->addTag('snc_redis.client', array('alias' => $client['alias']));
if (1 === $connectionCount) {
if (1 === $connectionCount && !isset($client['options']['cluster'])) {
$clientDef->addArgument(new Reference(sprintf('snc_redis.connection.%s_parameters.%s', $connectionAliases[0], $client['alias'])));
} else {
$connections = array();
Expand Down

0 comments on commit 5d8169e

Please sign in to comment.