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

Only restart client if the contents of the watched files have changed #2745

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

vinistock
Copy link
Member

Motivation

Related to #2692

I don't know what in the user's setup is causing .rubocop.yml to be touched repeatedly, but we had issues in the past when the lockfile was continuously getting updated and we got into a restart loop.

I think we should protect our file watchers from restarting when a file was touched, but the contents are still the same.

Implementation

Since the restart watchers are based on glob patterns, the idea is to let the first restart happen and remember the SHA of the content when we performed the restart. In subsequent file watch hits, we only restart if the contents were modified, otherwise we do nothing.

@vinistock vinistock added bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes labels Oct 21, 2024
@vinistock vinistock self-assigned this Oct 21, 2024
@vinistock vinistock requested a review from a team as a code owner October 21, 2024 19:04
Copy link
Contributor

@andyw8 andyw8 left a comment

Choose a reason for hiding this comment

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

I'd be hesitant about doing this only to target #2692, since it's only impacting one user, but as it will have a side-benefit of reducing unnecessary restarts then let's go ahead.

@vinistock vinistock merged commit 1518ce4 into main Oct 21, 2024
35 checks passed
@vinistock vinistock deleted the vs-check-file-content-before-restart branch October 21, 2024 19:55
@lolychee
Copy link

It worked for me. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants