Skip to content

Commit

Permalink
[mms] In the Predis driver, ramp up to the maximum unlock wait interv…
Browse files Browse the repository at this point in the history
…al (Request #13231).
  • Loading branch information
slusarz committed May 29, 2014
1 parent 5cd6d79 commit fe94374
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions framework/HashTable/lib/Horde/HashTable/Predis.php
Expand Up @@ -175,10 +175,10 @@ public function hkey($key)
public function lock($key)
{
$hkey = $this->hkey($key) . self::LOCK_SUFFIX;
$i = 0;

while (!$this->_predis->setnx($hkey, 1)) {
/* Wait 0.1 secs before attempting again. */
usleep(100000);
usleep(min(pow(2, $i++) * 10000, 100000));
}

$this->_predis->expire($hkey, self::LOCK_TIMEOUT);
Expand Down
4 changes: 2 additions & 2 deletions framework/HashTable/package.xml
Expand Up @@ -21,7 +21,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [mms] In the Predis driver, ramp up to the maximum unlock wait interval (Request #13231).
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -237,7 +237,7 @@
<date>2014-04-03</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [mms] In the Predis driver, ramp up to the maximum unlock wait interval (Request #13231).
</notes>
</release>
</changelog>
Expand Down

0 comments on commit fe94374

Please sign in to comment.