nextcloud / nextcloud/text

Sync endpoint always sets up the file sytem

Open
#1,184 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature: sync performance 🚀
Dominant language
JavaScript
Stars
659
Forks
133
Avg merge
1d 20h
Merged PRs (30d)
110

Description

The sync endpoint actually always sets up the filesystem for the user due to the current way we check if the file has changed outside:

text_sync_file_session

We mainly need to obtain the mtime and etag of the file to detect if it was changed or if it should be autosaved and ideally we only need to go to the filesystem layer in those cases. However I currently don't see a proper way of only obtaining those details without querying the filecache directly, which we could do since we have the file id. Alternatively we can probably introduce our own state handling by hooking into the postWrite hook and basically marking text documents as changed outside then.

@rullzer Do you see any other way? I'd probably prefer just querying the filecache directly from a implementation perspective but the hook feels a bit cleaner.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the sync endpoint and trace how it checks whether a file changed outside the editor, including the filesystem and filecache layers. Compare obtaining the file's mtime and etag through the filecache with tracking changes through the postWrite hook; done means unchanged files no longer set up the filesystem while changed or autosaved files still work.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.