Welcome Guest, Not a member yet? Register   Sign In
Losing session while using redis Driver
#4

Yeah session_write_close() is needed and already implemented. 
However, while the 3.1.6 patch is correctly using the "SET resource-name anystring NX EX max-lock-time" from Redis home page https://redis.io/commands/set I'd say that the code is wrong. It is wrong because from 3.1.6, no retries are being made but instead there is a return FALSE after the failed call to $this->_redis->set() shouldn't that be a continue?


PHP Code:
$attempt 0;
do
{
    if ((
$ttl $this->_redis->ttl($lock_key)) > 0)
    {
        
sleep(1);
        continue;
    }

    
$result = ($ttl === -2)
        ? 
$this->_redis->set($lock_keytime(), array('nx''ex' => 300))
        : 
$this->_redis->setex($lock_key300time());

    if ( ! 
$result)
    {
        
log_message('error''Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id);
        return 
FALSE// THIS SHOULD BE continue TO ALLOW UP TO 30 ATTEMPTS TO GET THE LOCK?
    
}

    
$this->_lock_key $lock_key;
    break;
}
while (++
$attempt 30); 
Reply


Messages In This Thread
RE: Losing session while using redis Driver - by tgix - 10-16-2018, 05:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB