summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index 7262a2300..c9a98b822 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -383,16 +383,16 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
continue;
}
- $result = ($ttl === -2)
- ? $this->_redis->set($lock_key, time(), array('nx', 'ex' => 300))
- : $this->_redis->setex($lock_key, 300, time());
-
- if ( ! $result)
+ if ($ttl === -2 && ! $this->_redis->set($lock_key, time(), array('nx', 'ex' => 300)))
{
- // Sleep for 0.1s to wait for lock releases.
- usleep(100000);
+ // Sleep for 1s to wait for lock releases.
+ sleep(1);
continue;
}
+ elseif ($ttl === -1 && ! $this->_redis->setex($lock_key, 300, time())) {
+ log_message('error', 'Session: Error while trying to obtain lock for '.$this->_key_prefix.$session_id);
+ return FALSE;
+ }
$this->_lock_key = $lock_key;
break;