From 4df80a3fa3f498bcd9db79e056b70a5779fecf47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 26 Jun 2019 12:40:05 +0200 Subject: Ignore locking exceptions on autosave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/Service/DocumentService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index f27b1c5ed..611ee1c68 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -50,6 +50,7 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\ICache; use OCP\ICacheFactory; use OCP\ILogger; +use OCP\Lock\LockedException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager as ShareManager; @@ -256,7 +257,12 @@ class DocumentService { if ($lastMTime > 0 && $file->getEtag() !== $document->getLastSavedVersionEtag() && $force === false) { throw new DocumentSaveConflictException('File changed in the meantime from outside'); } - $file->putContent($autoaveDocument); + try { + $file->putContent($autoaveDocument); + } catch (LockedException $e) { + // Ignore lock since it might occur when multiple people save at the same time + return $document; + } $document->setLastSavedVersion($version); $document->setLastSavedVersionTime(time()); $document->setLastSavedVersionEtag($file->getEtag()); -- cgit v1.2.3