Skip to content

Commit

Permalink
fix(sync): keep yjs file during sync session cleanup
Browse files Browse the repository at this point in the history
Even if all sessions have expired and been removed
there may still be disconnected clients
that hold state from the last editing session.

When they reconnect they will send their yjs updates
based on the old state they had.
Preserve the yjs state accross editing sessions
so updates send after a reconnect can still be processed.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Jan 18, 2024
1 parent 313aa5d commit 0c782e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ public function resetDocument(int $documentId, bool $force = false): void {
$this->sessionMapper->deleteByDocumentId($documentId);
$this->documentMapper->delete($document);

$this->getStateFile($documentId)->delete();
if ($force) {
$this->getStateFile($documentId)->delete();
}
$this->logger->debug('document reset for ' . $documentId);
} catch (DoesNotExistException|NotFoundException $e) {
// Ignore if document not found or state file not found
Expand Down

0 comments on commit 0c782e2

Please sign in to comment.