Issue #1969420 by Berdir: Fixed Unecessary semaphore cleanup query on every request.

8.0.x
catch 2013-04-15 22:24:39 +01:00
parent 80931c9a5b
commit 139ba19155
1 changed files with 9 additions and 6 deletions

View File

@ -115,12 +115,15 @@ class DatabaseLockBackend extends LockBackendAbstract {
* Implements Drupal\Core\Lock\LockBackedInterface::releaseAll().
*/
public function releaseAll($lock_id = NULL) {
$this->locks = array();
if (empty($lock_id)) {
$lock_id = $this->getLockId();
// Only attempt to release locks if any were acquired.
if (!empty($this->locks)) {
$this->locks = array();
if (empty($lock_id)) {
$lock_id = $this->getLockId();
}
db_delete('semaphore')
->condition('value', $lock_id)
->execute();
}
db_delete('semaphore')
->condition('value', $lock_id)
->execute();
}
}