Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix runner client race condition #270

Merged
merged 2 commits into from
Feb 23, 2024
Merged

Conversation

vinistock
Copy link
Member

Because of the memoized client method, we had a race condition. Every time someone hovered over something while the runner was still booting it would try to boot another server, since the @client variable was not yet set.

This PR changes the way we use client to begin initializing it with a NullClient. That way, features that depend on the client like hover continue to operate normally.

On activate, we spawn a thread that will initialize the real client concurrently. Once the thread finishes, then subsequent requests will get the information coming from the real server, without blocking any hover requests during the process.

We also need to bump the requirement on ruby-lsp to get Shopify/ruby-lsp#1400 or else the initialize method is not invoked properly.

@vinistock vinistock added the bugfix This PR fixes an existing bug label Feb 22, 2024
@vinistock vinistock self-assigned this Feb 22, 2024
@vinistock vinistock requested a review from a team as a code owner February 22, 2024 20:14
@vinistock vinistock merged commit 6c797cb into main Feb 23, 2024
54 checks passed
@vinistock vinistock deleted the vs/fix_runner_client_race_condition branch February 23, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants