paranext / paranext-core

Electron client, extension host, and C# library for Paranext
https://paranext.github.io/paranext-core/
MIT License
17 stars 2 forks source link

Close clients well #115

Open tjcouch-sil opened 1 year ago

tjcouch-sil commented 1 year ago

We need the server to give client processes a chance to save up and close.

Possible execution flows:

  1. Server tells clients to close (and sets a timer to just hard close if not all clients are finished)
    • a. (At server startup, registers a request handler listening for when a process is done saving) WebSocket server sends out an event to tell clients to close
    • b. (At client startup, each client registers a request handler specific to its client id that tells the server it is done closing) server sends a request to each client to close
  2. Each client does its own closing logic and tells the server it is done
    • a. client sends a request to the server indicating it is done
    • b. client sends response to the request the server sent after finishing
    • c. client closes its WebSocket connection to indicate it is finished
  3. When each client has told the server it is done or the server's close timer runs out, close down

Depends on #37

tjcouch-sil commented 2 months ago

After Matt and I had a discussion about new processes launched by extensions not being closed in development, we decided that this issue should receive higher priority. We should do something to close these processes. Maybe get rid of nodemon and just use chokidar to watch the files ourselves. Maybe send a message over websocket giving things a chance to close. Maybe listen to closing of the websocket as a hint to shut down.