Merge "rdbms: split out private LoadBalancer::openLocalConnection method"
[lhc/web/wiklou.git] / includes / libs / lockmanager / RedisLockManager.php
index 6001705..a624f0a 100644 (file)
@@ -76,7 +76,7 @@ class RedisLockManager extends QuorumLockManager {
        protected function getLocksOnServer( $lockSrv, array $pathsByType ) {
                $status = StatusValue::newGood();
 
-               $pathList = call_user_func_array( 'array_merge', array_values( $pathsByType ) );
+               $pathList = array_merge( ...array_values( $pathsByType ) );
 
                $server = $this->lockServers[$lockSrv];
                $conn = $this->redisPool->getConnection( $server, $this->logger );
@@ -102,7 +102,7 @@ class RedisLockManager extends QuorumLockManager {
 <<<LUA
                        local failed = {}
                        -- Load input params (e.g. session, ttl, time of request)
-                       local rSession, rTTL, rTime = unpack(ARGV)
+                       local rSession, rTTL, rMaxTTL, rTime = unpack(ARGV)
                        -- Check that all the locks can be acquired
                        for i,requestKey in ipairs(KEYS) do
                                local _, _, rType, resourceKey = string.find(requestKey,"(%w+):(%w+)$")
@@ -133,7 +133,7 @@ class RedisLockManager extends QuorumLockManager {
                                        local _, _, rType, resourceKey = string.find(requestKey,"(%w+):(%w+)$")
                                        redis.call('hSet',resourceKey,rType .. ':' .. rSession,rTime + rTTL)
                                        -- In addition to invalidation logic, be sure to garbage collect
-                                       redis.call('expire',resourceKey,rTTL)
+                                       redis.call('expire',resourceKey,rMaxTTL)
                                end
                        end
                        return failed
@@ -144,7 +144,8 @@ LUA;
                                        [
                                                $this->session, // ARGV[1]
                                                $this->lockTTL, // ARGV[2]
-                                               time() // ARGV[3]
+                                               self::MAX_LOCK_TTL, // ARGV[3]
+                                               time() // ARGV[4]
                                        ]
                                ),
                                count( $pathsByKey ) # number of first argument(s) that are keys
@@ -170,7 +171,7 @@ LUA;
        protected function freeLocksOnServer( $lockSrv, array $pathsByType ) {
                $status = StatusValue::newGood();
 
-               $pathList = call_user_func_array( 'array_merge', array_values( $pathsByType ) );
+               $pathList = array_merge( ...array_values( $pathsByType ) );
 
                $server = $this->lockServers[$lockSrv];
                $conn = $this->redisPool->getConnection( $server, $this->logger );