Fix PDO prune not called

This commit is contained in:
Jérémy Derussé 2019-06-17 20:49:50 +02:00
parent 432c21f83c
commit fc2dc14924
No known key found for this signature in database
GPG Key ID: 2083FA5758C473D2

View File

@ -124,9 +124,6 @@ class PdoStore implements StoreInterface
try { try {
$stmt->execute(); $stmt->execute();
$this->checkNotExpired($key);
return;
} catch (DBALException $e) { } catch (DBALException $e) {
// the lock is already acquired. It could be us. Let's try to put off. // the lock is already acquired. It could be us. Let's try to put off.
$this->putOffExpiration($key, $this->initialTtl); $this->putOffExpiration($key, $this->initialTtl);
@ -135,11 +132,11 @@ class PdoStore implements StoreInterface
$this->putOffExpiration($key, $this->initialTtl); $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)) { if ($this->gcProbability > 0 && (1.0 === $this->gcProbability || (random_int(0, PHP_INT_MAX) / PHP_INT_MAX) <= $this->gcProbability)) {
$this->prune(); $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 private function prune(): void
{ {