Skip to content

Commit

Permalink
Fix lock expire
Browse files Browse the repository at this point in the history
  • Loading branch information
cvasseur committed Apr 17, 2014
1 parent 2e3f6b7 commit 7367e3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Blablacar/Redis/SessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function lock($sessionId)
$this->lockKey = $this->getSessionLockKey($sessionId);
for ($i = 0; $i < $attempts; $i++) {
if ($this->client->setnx($this->lockKey, 1)) {
$this->client->expire($this->lockKey, $this->lockMaxWait / 1000 + 1);
$this->client->expire($this->lockKey, $this->lockMaxWait / 1000000 + 1);
$this->isLocked = true;

return true;
Expand Down
2 changes: 1 addition & 1 deletion tests/Blablacar/Redis/SessionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function tearDown()
protected function clientLock(ObjectProphecy $client)
{
$client->setnx(Argument::type('string'), Argument::exact(1))->willReturn(true);
$client->expire(Argument::type('string'), Argument::exact(30001))->willReturn(true);
$client->expire(Argument::type('string'), Argument::exact(31))->willReturn(true);
$client->del(Argument::type('string'))->willReturn(true);
}

Expand Down

0 comments on commit 7367e3f

Please sign in to comment.