Skip to content

document_ttl squash logic may never be invoked for busy notebooks #117

Description

@krassowski

Description

document_ttl compares the time elapsed since the previous update was sent, thus often preventing squashing the updates for more active notebooks for a long time.

Reproduce

  1. Install ipylab
  2. Run jupyter lab --SQLiteYStore.document_ttl=1
  3. Create a notebook with one cell:
from ipylab import JupyterFrontEnd
from time import sleep

app = JupyterFrontEnd()

for i in range(1000):
    app.commands.execute('notebook:insert-cell-below')
    sleep(0.1)
    app.commands.execute('notebook:delete-cell')
    sleep(0.1)
  1. See that condition diff > self.document_ttl is never true, thus the squashing logic never gets executed:
    https://github.com/jupyter-server/pycrdt-websocket/blob/3a5648dc937baca71eb9e997a6aaf8e3d6c91654/pycrdt_websocket/ystore.py#L489

Expected behavior

We have a way to prevent SQL store from blowing to dangerous sizes, even if user continues to edit it. For example, if we set --SQLiteYStore.document_ttl=60 we expect to be able to have no more than 1 minute buffer in the history.

Context

pycrdt                    0.12.11
pycrdt-websocket          0.15.4
jupyterlab                4.4.0
jupyter-collaboration     4.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions