diff options
author | C. Montero Luque <cmonteroluque@users.noreply.github.com> | 2016-03-04 15:43:08 -0500 |
---|---|---|
committer | C. Montero Luque <cmonteroluque@users.noreply.github.com> | 2016-03-04 15:43:08 -0500 |
commit | 4dda119137e29be11cf652515a66e970be572df0 (patch) | |
tree | d59c149efeb84b4f46fbaffb1f80b0e5e53899e9 /lib/private/lock/dblockingprovider.php | |
parent | 45f49a090aea50b29a9162717ce38799cd0c7111 (diff) | |
parent | 7a0720f30061bdf948d9eae15e4872c927792bfb (diff) | |
download | nextcloud-server-4dda119137e29be11cf652515a66e970be572df0.tar.gz nextcloud-server-4dda119137e29be11cf652515a66e970be572df0.zip |
Merge pull request #22865 from owncloud/fix-db-locking-cleanup
Run cleanup of expired DB file locks to background job
Diffstat (limited to 'lib/private/lock/dblockingprovider.php')
-rw-r--r-- | lib/private/lock/dblockingprovider.php | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php index 647250cdb6f..c10cd8636ad 100644 --- a/lib/private/lock/dblockingprovider.php +++ b/lib/private/lock/dblockingprovider.php @@ -235,10 +235,17 @@ class DBLockingProvider extends AbstractLockingProvider { */ public function cleanExpiredLocks() { $expire = $this->timeFactory->getTime(); - $this->connection->executeUpdate( - 'DELETE FROM `*PREFIX*file_locks` WHERE `ttl` < ?', - [$expire] - ); + try { + $this->connection->executeUpdate( + 'DELETE FROM `*PREFIX*file_locks` WHERE `ttl` < ?', + [$expire] + ); + } catch (\Exception $e) { + // If the table is missing, the clean up was successful + if ($this->connection->tableExists('file_locks')) { + throw $e; + } + } } /** @@ -257,15 +264,4 @@ class DBLockingProvider extends AbstractLockingProvider { } } } - - public function __destruct() { - try { - $this->cleanExpiredLocks(); - } catch (\Exception $e) { - // If the table is missing, the clean up was successful - if ($this->connection->tableExists('file_locks')) { - throw $e; - } - } - } } |