Skip to content
Prev Previous commit
Next Next commit
fix: Rework save locking
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and backportbot-nextcloud[bot] committed Mar 9, 2023
commit 2dd921d3996398f78dcf8b347a9cad8e1862f1e5
11 changes: 6 additions & 5 deletions lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,16 @@ public function autosave(?File $file, int $documentId, int $version, ?string $au
$this->writeDocumentState($file->getId(), $documentState);
}
});
$document->setLastSavedVersion($stepsVersion);
$document->setLastSavedVersionTime(time());
$document->setLastSavedVersionEtag($file->getEtag());
$this->documentMapper->update($document);
} catch (LockedException $e) {
// Ignore lock since it might occur when multiple people save at the same time
return $document;
} finally {
$this->cache->remove('document-save-lock-' . $documentId);
}
$document->setLastSavedVersion($stepsVersion);
$document->setLastSavedVersionTime(time());
$document->setLastSavedVersionEtag($file->getEtag());
$this->documentMapper->update($document);
$this->cache->remove('document-save-lock-' . $documentId);
return $document;
}

Expand Down