jupyterlab / jupyter-collaboration

A Jupyter Server Extension Providing Support for Y Documents
https://jupyterlab-realtime-collaboration.readthedocs.io/en/latest/
Other
170 stars 31 forks source link

Use `hash` to check if the file has changed on disk #340

Open krassowski opened 3 months ago

krassowski commented 3 months ago

Now that we use the file hash, we could use it to check if the server was the one who saved the file last, instead of using timestamps (see https://github.com/jupyter-server/jupyter_server/pull/1367#issuecomment-1824567329 and https://github.com/jupyterlab/jupyterlab/issues/14031#issuecomment-2222915285). This could be done in another PR.

Originally posted by @davidbrochart in https://github.com/jupyterlab/jupyter-collaboration/issues/337#issuecomment-2304017214

Upstream JupyterLab checks hash if present and if not then falls back to timestamp comparison. There are some cases when hash is better because touching file when changing branches or similar (but keeping the content the same) does change timestamp but not the hash. hash is only available with newer jupyter-server (2.11.1 or newer).