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 FileResource sometimes sending contents change event during writing #14043

Merged

Conversation

Hanksha
Copy link
Contributor

@Hanksha Hanksha commented Aug 14, 2024

What it does

This PR adds a lock to the write operations of the FileResource (doWrite and doSaveContentChanges) so that if a change event is received from the FileService it must wait for the writing to be done (which sets the up to date version) before to check if the file is synced (which involves resolving it and checking the mtime).

Fixes #14021

Contributed on behalf of Toro Cloud

How to test

I added a unit test at packages/filesystem/src/browser/file-resource.spec.ts that can be used to check the behavior. Alternatively you can follow the steps to reproduce described here and see if you cannot reproduce it anymore.

Follow-ups

Review checklist

Reminder for reviewers

event during writing

Add a lock to the write operation so that checking
if the file is synced must wait for the write
operation to be done.

Fixes eclipse-theia#14021

Contributed on behalf of Toro Cloud

Signed-off-by: Vivien Jovet <[email protected]>
@Hanksha Hanksha force-pushed the gh-14021-fix-file-resource-event branch from 36f7304 to c3c3456 Compare August 14, 2024 10:51
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to me 👍

@JonasHelming
Copy link
Contributor

@msujew Do you want to merge this?

@msujew msujew merged commit 638c071 into eclipse-theia:master Sep 4, 2024
14 checks passed
@Hanksha Hanksha deleted the gh-14021-fix-file-resource-event branch September 5, 2024 06:01
@sgraband sgraband added this to the 1.54.0 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

FileResource sometimes triggers incorrect contents change events
5 participants