cylc-uiserver
cylc-uiserver copied to clipboard
server: implement the current_activity interface
Jupyter Server extension applications may implement a current_activity
interface.
This is used to inform Jupyter Server of any activity with the extension for the purposes of implementing the shutdown_no_activity_timeout
which is a handy way of killing idle servers.
https://github.com/jupyter-server/jupyter_server/blob/b85c15b5678cd6ea9de28e4f547bc0dfef0a69c7/jupyter_server/extension/application.py#L449-L451
In Cylc UI Server, we would consider "activity" to mean GraphQL queries or active websocket connections. So this would require listing active websocket connections which is an issue which will also need to be solved for #585 and #597.
There are currently two caveats to this approach:
- Currently, if a client disconnects, the server might not find out about this until the next update is sent to the client.
- This means that websocket connections may remain alive indefinitely if no workflows are active.
- This can be resolved by configuring a websocket ping interval, however, we are currently waiting for an upstream fix to go in before we can do this.
- https://github.com/cylc/cylc-uiserver/issues/557
- The Cylc UI app may remain active as long as it is open somewhere in a browser tab.
- This means that long forgotten browser tabs will cause open websockets.
- The solution is to introduce a UI timeout.
- https://github.com/cylc/cylc-ui/issues/1846