WIP: Process shake restarts asynchronously#4879
WIP: Process shake restarts asynchronously#4879crtschin wants to merge 6 commits intohaskell:masterfrom
Conversation
cc251cd to
88e0f88
Compare
0a7302b to
4090ec3
Compare
|
I can't get tests to pass with notifications fully async. Kinda makes sense looking at what these notifications indicate. I thought I could get away with only LSP handling everything synchronously of the VFS-side, but it appears not. I'm now trying out a small variant where notifications are still synchronously, but that the session restarts are initiated async, while still blocking subsequent LSP requests. So restarts still get squashed. |
42b60e4 to
69e0d70
Compare
0933d63 to
1dfd24e
Compare
1dfd24e to
5978cad
Compare
| sessionRestartTQueue <- withWorkerQueueSimple (cmapWithPrio Session.LogSessionWorkerThread recorder) "RestartTQueue" | ||
| sessionRestartTQueue <- liftIO $ newRestartSlot | ||
| sessionLoaderTQueue <- withWorkerQueueSimple (cmapWithPrio Session.LogSessionWorkerThread recorder) "SessionLoaderTQueue" | ||
| ContT $ \action -> withRestartWorker ideMVar $ action () |
There was a problem hiding this comment.
better to extend the logic of workerThread module so it can be reused here.
there is a slight chance that downstream code would swallow the async exception and hang the shutdown. workerThread handled that by setting up a shutdown flag .
Thanks for taking a peak at the PR! The idea I'm going for now here is to still have notifications be synchronous, but that they don't wait for the shake restart to finish, unlike now. So multiple subsequent edits will issue multiple synchronous notifications which will all start asynchronous shake restarts. This allows the restarts to merge. Note that this is still me experimenting, I'm not sure if I'm breaking preconditions. This is all quite nuancy. |
good idea
I’ve experienced this before: if we don’t wait for Shake to fully restart, requests may observe stale state. I think we should ensure any pending restarts have completed before processing new requests but keep the notifications side of the story as you suggested, It might work. Also it might be a good idea to go through the occurences of ----- update ---- Also we should move the "updatePositionMapping" in the notification handler into restart so every restart(merged or not) would see consistent mapping state ? |
Would close #4725.
Implements the ideas from #4725 (comment). Makes the following changes: