mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Remove the need for the transaction in the database locking backend
This commit is contained in:
parent
c9397dffea
commit
7c66328381
1 changed files with 1 additions and 16 deletions
|
|
@ -76,11 +76,10 @@ class DBLockingProvider extends AbstractLockingProvider {
|
|||
* @throws \OCP\Lock\LockedException
|
||||
*/
|
||||
public function acquireLock($path, $type) {
|
||||
if ($this->connection->inTransaction()){
|
||||
if ($this->connection->inTransaction()) {
|
||||
$this->logger->warning("Trying to acquire a lock for '$path' while inside a transition");
|
||||
}
|
||||
|
||||
$this->connection->beginTransaction();
|
||||
$this->initLockField($path);
|
||||
if ($type === self::LOCK_SHARED) {
|
||||
$result = $this->connection->executeUpdate(
|
||||
|
|
@ -93,7 +92,6 @@ class DBLockingProvider extends AbstractLockingProvider {
|
|||
[$path]
|
||||
);
|
||||
}
|
||||
$this->connection->commit();
|
||||
if ($result !== 1) {
|
||||
throw new LockedException($path);
|
||||
}
|
||||
|
|
@ -146,17 +144,4 @@ class DBLockingProvider extends AbstractLockingProvider {
|
|||
}
|
||||
$this->markChange($path, $targetType);
|
||||
}
|
||||
|
||||
/**
|
||||
* cleanup empty locks
|
||||
*/
|
||||
public function cleanEmptyLocks() {
|
||||
$this->connection->executeUpdate(
|
||||
'DELETE FROM `*PREFIX*file_locks` WHERE `lock` = 0'
|
||||
);
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
$this->cleanEmptyLocks();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue