8000 bug #23237 [Cache] Fix Predis client cluster with pipeline (flolivaud) · symfony/symfony@7bb72b0 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7bb72b0

Browse files
committed
bug #23237 [Cache] Fix Predis client cluster with pipeline (flolivaud)
This PR was merged into the 3.3 branch. Discussion ---------- [Cache] Fix Predis client cluster with pipeline | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- a85d5b0 Fix Predis client cluster with pipeline
2 parents 383c6ac + a85d5b0 commit 7bb72b0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Cache\Traits;
1313

1414
use Predis\Connection\Factory;
15+
use Predis\Connection\Aggregate\ClusterInterface;
1516
use Predis\Connection\Aggregate\PredisCluster;
1617
use Predis\Connection\Aggregate\RedisCluster;
1718
use Predis\Response\Status;
@@ -284,7 +285,7 @@ private function pipeline(\Closure $generator)
284285
{
285286
$ids = array();
286287

287-
if ($this->redis instanceof \Predis\Client) {
288+
if ($this->redis instanceof \Predis\Client && !$this->redis->getConnection() instanceof ClusterInterface) {
288289
$results = $this->redis->pipeline(function ($redis) use ($generator, &$ids) {
289290
foreach ($generator() as $command => $args) {
290291
call_user_func_array(array($redis, $command), $args);
@@ -308,9 +309,10 @@ private function pipeline(\Closure $generator)
308309
foreach ($results as $k => list($h, $c)) {
309310
$results[$k] = $connections[$h][$c];
310311
}
311-
} elseif ($this->redis instanceof \RedisCluster) {
312-
// phpredis doesn't support pipelining with RedisCluster
312+
} elseif ($this->redis instanceof \RedisCluster || ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface)) {
313+
// phpredis & predis don't support pipelining with RedisCluster
313314
// see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining
315+
// see https://github.com/nrk/predis/issues/267#issuecomment-123781423
314316
$results = array();
315317
foreach ($generator() as $command => $args) {
316318
$results[] = call_user_func_array(array($this->redis, $command), $args);

0 commit comments

Comments
 (0)
0