Skip to content

Commit 97e9949

Browse files
max-nextcloudmejo-
authored andcommitted
fix(save): autosave only every ten seconds
Abort autosave if another save is still under way. We observed save requests taking up to 30 seconds. In this timespan autosave requests would still be processed as the lastSavedTime in the database has not been updated yet. Signed-off-by: Max <max@nextcloud.com>
1 parent 97d1d61 commit 97e9949

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/Service/DocumentService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,11 @@ public function autosave(Document $document, File $file, int $version, string $a
385385

386386
$this->assertNoOutsideConflict($document, $file, $force);
387387

388+
// Abort autosave if already saving.
389+
if ($this->cache->get('document-save-lock-' . $documentId) && $manualSave === false) {
390+
return $document;
391+
}
392+
388393
// Do not save if newer version already saved
389394
// Note that $version is the version of the steps the client has fetched.
390395
// It may have added steps on top of that - so if the versions match we still save.

0 commit comments

Comments
 (0)