Browse Source

Do not pipeline initialization commands.

Daniele Alessandri 11 years ago
parent
commit
8d15e5ec08

+ 3 - 14
lib/Predis/Connection/PhpiredisConnection.php

@@ -293,7 +293,9 @@ class PhpiredisConnection extends AbstractConnection
         $this->connectWithTimeout($this->parameters);
 
         if ($this->initCmds) {
-            $this->sendInitializationCommands();
+            foreach ($this->initCmds as $command) {
+                $this->executeCommand($command);
+            }
         }
     }
 
@@ -308,19 +310,6 @@ class PhpiredisConnection extends AbstractConnection
         }
     }
 
-    /**
-     * Sends the initialization commands to Redis when the connection is opened.
-     */
-    private function sendInitializationCommands()
-    {
-        foreach ($this->initCmds as $command) {
-            $this->writeCommand($command);
-        }
-        foreach ($this->initCmds as $command) {
-            $this->readResponse($command);
-        }
-    }
-
     /**
      * {@inheritdoc}
      */

+ 3 - 14
lib/Predis/Connection/StreamConnection.php

@@ -126,7 +126,9 @@ class StreamConnection extends AbstractConnection
         parent::connect();
 
         if ($this->initCmds) {
-            $this->sendInitializationCommands();
+            foreach ($this->initCmds as $command) {
+                $this->executeCommand($command);
+            }
         }
     }
 
@@ -141,19 +143,6 @@ class StreamConnection extends AbstractConnection
         }
     }
 
-    /**
-     * Sends the initialization commands to Redis when the connection is opened.
-     */
-    private function sendInitializationCommands()
-    {
-        foreach ($this->initCmds as $command) {
-            $this->writeCommand($command);
-        }
-        foreach ($this->initCmds as $command) {
-            $this->readResponse($command);
-        }
-    }
-
     /**
      * Performs a write operation on the stream of the buffer containing a
      * command serialized with the Redis wire protocol.