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 );
<<<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+)$")
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
[
$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
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 );