1414use Clue \Redis \Protocol \Model \ErrorReply ;
1515use Clue \Redis \Protocol \Model \ModelInterface ;
1616use Clue \Redis \Protocol \Model \MultiBulkReply ;
17- use Clue \Redis \Protocol \Model \StatusReply ;
1817use React \Stream \DuplexStreamInterface ;
1918
2019/**
@@ -31,7 +30,6 @@ class StreamingClient extends EventEmitter implements Client
3130
3231 private $ subscribed = 0 ;
3332 private $ psubscribed = 0 ;
34- private $ monitoring = false ;
3533
3634 public function __construct (DuplexStreamInterface $ stream , ParserInterface $ parser = null , SerializerInterface $ serializer = null )
3735 {
@@ -89,17 +87,14 @@ public function __call($name, $args)
8987 $ request ->reject (new RuntimeException ('Connection closed ' ));
9088 } elseif (count ($ args ) !== 1 && in_array ($ name , $ pubsubs )) {
9189 $ request ->reject (new InvalidArgumentException ('PubSub commands limited to single argument ' ));
90+ } elseif ($ name === 'monitor ' ) {
91+ $ request ->reject (new \BadMethodCallException ('MONITOR command explicitly not supported ' ));
9292 } else {
9393 $ this ->stream ->write ($ this ->serializer ->getRequestMessage ($ name , $ args ));
9494 $ this ->requests []= $ request ;
9595 }
9696
97- if ($ name === 'monitor ' ) {
98- $ monitoring =& $ this ->monitoring ;
99- $ promise ->then (function () use (&$ monitoring ) {
100- $ monitoring = true ;
101- });
102- } elseif (in_array ($ name , $ pubsubs )) {
97+ if (in_array ($ name , $ pubsubs )) {
10398 $ that = $ this ;
10499 $ subscribed =& $ this ->subscribed ;
105100 $ psubscribed =& $ this ->psubscribed ;
@@ -124,11 +119,6 @@ public function __call($name, $args)
124119
125120 public function handleMessage (ModelInterface $ message )
126121 {
127- if ($ this ->monitoring && $ this ->isMonitorMessage ($ message )) {
128- $ this ->emit ('monitor ' , array ($ message ));
129- return ;
130- }
131-
132122 if (($ this ->subscribed !== 0 || $ this ->psubscribed !== 0 ) && $ message instanceof MultiBulkReply) {
133123 $ array = $ message ->getValueNative ();
134124 $ first = array_shift ($ array );
@@ -192,10 +182,4 @@ public function close()
192182 $ request ->reject (new RuntimeException ('Connection closing ' ));
193183 }
194184 }
195-
196- private function isMonitorMessage (ModelInterface $ message )
197- {
198- // Check status '1409172115.207170 [0 127.0.0.1:58567] "ping"' contains otherwise uncommon '] "'
199- return ($ message instanceof StatusReply && strpos ($ message ->getValueNative (), '] " ' ) !== false );
200- }
201185}
0 commit comments