Allow PubSub / MultiExec with Replication

This commit is contained in:
Josias Montag
2022-05-27 11:14:06 +02:00
committed by Till Krüss
parent 15244c9642
commit e5221fa13b
5 changed files with 12 additions and 12 deletions
+3 -3
View File
@@ -12,7 +12,7 @@
namespace Predis\Monitor;
use Predis\ClientInterface;
use Predis\Connection\AggregateConnectionInterface;
use Predis\Connection\Cluster\ClusterInterface;
use Predis\NotSupportedException;
/**
@@ -56,9 +56,9 @@ class Consumer implements \Iterator
*/
private function assertClient(ClientInterface $client)
{
if ($client->getConnection() instanceof AggregateConnectionInterface) {
if ($client->getConnection() instanceof ClusterInterface) {
throw new NotSupportedException(
'Cannot initialize a monitor consumer over aggregate connections.'
'Cannot initialize a monitor consumer over cluster connections.'
);
}
+3 -3
View File
@@ -14,7 +14,7 @@ namespace Predis\PubSub;
use Predis\ClientException;
use Predis\ClientInterface;
use Predis\Command\Command;
use Predis\Connection\AggregateConnectionInterface;
use Predis\Connection\Cluster\ClusterInterface;
use Predis\NotSupportedException;
/**
@@ -62,9 +62,9 @@ class Consumer extends AbstractConsumer
*/
private function checkCapabilities(ClientInterface $client)
{
if ($client->getConnection() instanceof AggregateConnectionInterface) {
if ($client->getConnection() instanceof ClusterInterface) {
throw new NotSupportedException(
'Cannot initialize a PUB/SUB consumer over aggregate connections.'
'Cannot initialize a PUB/SUB consumer over cluster connections.'
);
}
+3 -3
View File
@@ -16,7 +16,7 @@ use Predis\ClientException;
use Predis\ClientInterface;
use Predis\Command\CommandInterface;
use Predis\CommunicationException;
use Predis\Connection\AggregateConnectionInterface;
use Predis\Connection\Cluster\ClusterInterface;
use Predis\NotSupportedException;
use Predis\Protocol\ProtocolException;
use Predis\Response\ErrorInterface as ErrorResponseInterface;
@@ -66,9 +66,9 @@ class MultiExec implements ClientContextInterface
*/
private function assertClient(ClientInterface $client)
{
if ($client->getConnection() instanceof AggregateConnectionInterface) {
if ($client->getConnection() instanceof ClusterInterface) {
throw new NotSupportedException(
'Cannot initialize a MULTI/EXEC transaction over aggregate connections.'
'Cannot initialize a MULTI/EXEC transaction over cluster connections.'
);
}
+2 -2
View File
@@ -46,9 +46,9 @@ class ConsumerTest extends PredisTestCase
public function testMonitorConsumerDoesNotWorkOnClusters(): void
{
$this->expectException('Predis\NotSupportedException');
$this->expectExceptionMessage('Cannot initialize a monitor consumer over aggregate connections');
$this->expectExceptionMessage('Cannot initialize a monitor consumer over cluster connections');
$cluster = $this->getMockBuilder('Predis\Connection\AggregateConnectionInterface')->getMock();
$cluster = $this->getMockBuilder('Predis\Connection\Cluster\ClusterInterface')->getMock();
$client = new Client($cluster);
new MonitorConsumer($client);
+1 -1
View File
@@ -45,7 +45,7 @@ class ConsumerTest extends PredisTestCase
public function testPubSubConsumerDoesNotWorkOnClusters(): void
{
$this->expectException('Predis\NotSupportedException');
$this->expectExceptionMessage('Cannot initialize a PUB/SUB consumer over aggregate connections');
$this->expectExceptionMessage('Cannot initialize a PUB/SUB consumer over cluster connections');
$cluster = $this->getMockBuilder('Predis\Connection\Cluster\ClusterInterface')->getMock();
$client = new Client($cluster);