Browse Source

Fix ISSUE #27.

Daniele Alessandri 14 năm trước cách đây
mục cha
commit
85c1a7a852
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      lib/Predis/MultiExecContext.php

+ 4 - 3
lib/Predis/MultiExecContext.php

@@ -108,8 +108,9 @@ class MultiExecContext {
     }
 
     public function discard() {
-        if ($this->_initialized === true || $this->_checkAndSet) {
-            $this->_client->discard();
+        if ($this->_initialized === true) {
+            $command = $this->_checkAndSet ? 'unwatch' : 'discard';
+            $this->_client->$command();
             $this->reset();
             $this->_discarded = true;
         }
@@ -178,7 +179,7 @@ class MultiExecContext {
 
             if (count($this->_commands) === 0) {
                 if ($this->_watchedKeys) {
-                    $this->_client->discard();
+                    $this->discard();
                     return;
                 }
                 return;