diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-06-26 13:40:05 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-06-26 13:40:05 +0300 |
commit | 4df80a3fa3f498bcd9db79e056b70a5779fecf47 (patch) | |
tree | 29cbd90389ace41482c93ae6d1f7f49f29fa8cd4 /lib | |
parent | 1ad91862bbfbd94609c1cd80893844c658020383 (diff) |
Ignore locking exceptions on autosave
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Service/DocumentService.php | 8 |
1 files changed, 7 insertions, 1 deletions
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()); |