-
Notifications
You must be signed in to change notification settings - Fork 391
Open
Labels
Description
Problem
Currently we use polling/infinite loops to check for file/directory status:
- frontends check for directory updates every 10 seconds
- jupyter-collaboration checks for file modifications every 1 second
This can mean that we end up hitting the Contents Manager GET too often and that users do not get updates as soon as they should. In case of out-of-band reload monitoring, this can generate many false-positive 404 logs as described in jupyterlab/jupyter-collaboration#517.
Proposed Solution
- listen to the filesystem changes
- easy on linux with
inotify(there are many Python wrappers) - there are good cross-platform solutions with a Python API:
- watchdog
- watchfiles - rust backed, in use by jupyverse
- easy on linux with
- emit events about changes in the root directory and its subdirectories to the frontend:
- we could use
jupyter-events
- we could use
- add an optional method to the
ContentsManagerallowing to check if it supports notification events for a given directory; this is becauseContentsManagerscould dispatch to different sources as inHybridContentsManager- we may also add a dedicated REST API endpoint or instead include this information in directory response (similar to how we added
hash)
- we may also add a dedicated REST API endpoint or instead include this information in directory response (similar to how we added
Additional context
We discussed using watchdog or watchfiles in jupyter-server/jupyter_server_fileid#80 too.
Reactions are currently unavailable