Skip to content

Commit

Permalink
Merge branch '4.2' into 4.3
Browse files Browse the repository at this point in the history
* 4.2:
  Fix PDO prune not called
  • Loading branch information
nicolas-grekas committed Jun 17, 2019
2 parents 1337dbf + c9ab846 commit 15652e3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Symfony/Component/Lock/Store/PdoStore.php
Expand Up @@ -124,9 +124,6 @@ public function save(Key $key)

try {
$stmt->execute();
$this->checkNotExpired($key);

return;
} catch (DBALException $e) {
// the lock is already acquired. It could be us. Let's try to put off.
$this->putOffExpiration($key, $this->initialTtl);
Expand All @@ -135,11 +132,11 @@ public function save(Key $key)
$this->putOffExpiration($key, $this->initialTtl);
}

$this->checkNotExpired($key);

if ($this->gcProbability > 0 && (1.0 === $this->gcProbability || (random_int(0, PHP_INT_MAX) / PHP_INT_MAX) <= $this->gcProbability)) {
$this->prune();
}

$this->checkNotExpired($key);
}

/**
Expand Down Expand Up @@ -289,7 +286,7 @@ public function createTable(): void
}

/**
* Cleanups the table by removing all expired locks.
* Cleans up the table by removing all expired locks.
*/
private function prune(): void
{
Expand Down

0 comments on commit 15652e3

Please sign in to comment.