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

Stagger lint and breaking checks in LSP Refresh #3547

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

doriable
Copy link
Member

Since lint and breaking change detection are more
expensive, we do not need to run them on every single
file refresh. Instead, we use the top-level LSP lock and a
short stagger (5ms) and only run when the attempt to get
the top-level lock is successful. Otherwise, we no-op and
assume that the checks are handled by another Refresh
request.

Copy link
Contributor

github-actions bot commented Dec 16, 2024

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedDec 16, 2024, 6:16 PM

go func() {
// Call TryLock, if unnsuccessful, then another thread holds the lock, so we provide a
// debug log and move on.
if !f.lsp.lock.TryLock() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of order. You want to sleep first, then attempt to grab the lock. Otherwise, this blocks requests from the LSP, which will mean the generated lints won't use the most recent content.

@doriable doriable merged commit 0560ffe into main Dec 16, 2024
10 checks passed
@doriable doriable deleted the lsp-stagger-lint-in-refresh branch December 16, 2024 19:16
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.

4 participants