Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/94935


Change subject: Expanded use of reauthenticateConnection() beyond just Lua calls
......................................................................

Expanded use of reauthenticateConnection() beyond just Lua calls

bug: 56886
Change-Id: I47d0f52e72b35ec5cb7b92b9cc3488f145b2d7a2
---
M includes/clientpool/RedisConnectionPool.php
1 file changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/35/94935/1

diff --git a/includes/clientpool/RedisConnectionPool.php 
b/includes/clientpool/RedisConnectionPool.php
index c8e98a7..13ebd65 100644
--- a/includes/clientpool/RedisConnectionPool.php
+++ b/includes/clientpool/RedisConnectionPool.php
@@ -285,7 +285,8 @@
        }
 
        /**
-        * Resend an AUTH request to the redis server (useful after disconnects)
+        * Resend an AUTH request to the redis server (useful after 
disconnects).
+        * This handles https://github.com/nicolasff/phpredis/issues/403.
         *
         * This method is for internal use only
         *
@@ -330,7 +331,18 @@
        }
 
        public function __call( $name, $arguments ) {
-               return call_user_func_array( array( $this->conn, $name ), 
$arguments );
+               $conn = $this->conn; // convenience
+
+               $conn->clearLastError();
+               $res = call_user_func_array( array( $conn, $name ), $arguments 
);
+               if ( preg_match( '/^ERR operation not permitted\b/', 
$conn->getLastError() ) ) {
+                       $this->pool->reauthenticateConnection( $this->server, 
$conn );
+                       $conn->clearLastError();
+                       $res = call_user_func_array( array( $conn, $name ), 
$arguments );
+                       wfDebugLog( 'redis', "Used automatic re-authentication 
for method '$name'." );
+               }
+
+               return $res;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/94935
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I47d0f52e72b35ec5cb7b92b9cc3488f145b2d7a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to