summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index 434b11e58..25bf80706 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -359,11 +359,13 @@ 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 1s to wait for lock releases.
+ sleep(1);
+ continue;
+ }
+ elseif ( ! $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;