From fc2dc1492446ed2fb8018d3fbf8cb42837003ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Mon, 17 Jun 2019 20:49:50 +0200 Subject: [PATCH] Fix PDO prune not called --- src/Symfony/Component/Lock/Store/PdoStore.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Lock/Store/PdoStore.php b/src/Symfony/Component/Lock/Store/PdoStore.php index 3b5049f84d..0cf3dd35f7 100644 --- a/src/Symfony/Component/Lock/Store/PdoStore.php +++ b/src/Symfony/Component/Lock/Store/PdoStore.php @@ -124,9 +124,6 @@ class PdoStore implements StoreInterface 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); @@ -135,11 +132,11 @@ class PdoStore implements StoreInterface $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); } /** @@ -289,7 +286,7 @@ class PdoStore implements StoreInterface } /** - * Cleanups the table by removing all expired locks. + * Cleans up the table by removing all expired locks. */ private function prune(): void {