Skip to content

Process notifications asynchronously#4879

Draft
crtschin wants to merge 8 commits intohaskell:masterfrom
crtschin:crtschin/deduplicate-shake-restarts
Draft

Process notifications asynchronously#4879
crtschin wants to merge 8 commits intohaskell:masterfrom
crtschin:crtschin/deduplicate-shake-restarts

Conversation

@crtschin
Copy link
Copy Markdown
Collaborator

@crtschin crtschin commented Mar 31, 2026

Would close #4725.

Implements the ideas from #4725 (comment). Makes the following changes:

  1. Processes notifications asynchronously keeping with the logic that notifications preceding any request, also finish before that request is processed. But does so asynchronously.
  2. The above opens up the possibility that there could be multiple shake restarts in-flight because multiple notifications arriving in quick succession. Instead of storing these restarts in a queue, accumulate all restart changes in a single slot, to be processed at once.

@crtschin crtschin requested review from fendor and wz1000 as code owners March 31, 2026 19:53
@crtschin crtschin marked this pull request as draft March 31, 2026 19:56
@crtschin crtschin force-pushed the crtschin/deduplicate-shake-restarts branch 4 times, most recently from cc251cd to 88e0f88 Compare April 1, 2026 23:22
@fendor fendor requested a review from soulomoon April 7, 2026 09:37
crtschin and others added 6 commits April 7, 2026 23:34
The shake session holds references to the sqlite connection. When the
stop signal is given and the scope is exitted, the sqlite connections
are closed, which outstanding threads may still be using. This leads
to use-after-frees. Ensure the session is shutdown prior to leaving the
worker scope.
@crtschin crtschin force-pushed the crtschin/deduplicate-shake-restarts branch from 0a7302b to 4090ec3 Compare April 9, 2026 17:27
@crtschin
Copy link
Copy Markdown
Collaborator Author

crtschin commented Apr 9, 2026

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.

@crtschin crtschin force-pushed the crtschin/deduplicate-shake-restarts branch from 84009af to 42b60e4 Compare April 9, 2026 20:19
@crtschin crtschin force-pushed the crtschin/deduplicate-shake-restarts branch from 42b60e4 to 69e0d70 Compare April 9, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce lag when editing by merging sequential Shake restarts

1 participant