Use flush_fs_events more after performing synchronous fs mutations#59
Merged
Use flush_fs_events more after performing synchronous fs mutations#59
flush_fs_events more after performing synchronous fs mutations#59Conversation
I am not sure I have caught all the examples of this, but in general I think we always want to perform a `flush_fs_events` as opposed to `next_scan_complete` when doing synchronous I/O. Indeed, the file system may inform us about the events caused by the just-performed I/O over multiple batches, and `next_scan_complete` may return before seeing all of them. Note that this also removes a few assertions which were ensuring that, on start, a worktree's file handle wouldn't know its deleted status, even if the file didn't exist for sure on disk. However, now that `file` is an async API, it's possible that by the time the `FileHandle` is resolved, `Worktree` has already completed scanning. We test a similar behavior further along in the test where those assertions were removed, so it felt okay to proceed without them.
Merged
Anthony-Eid
pushed a commit
to Anthony-Eid/zed
that referenced
this pull request
Nov 1, 2024
* Add current working directory to adapter * Prio use resolve cwd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am not sure I have caught all the examples of this, but in general I think we always want to perform a
flush_fs_eventsas opposed tonext_scan_completewhen doing synchronous I/O. Indeed, the file system may inform us about the events caused by the just-performed I/O over multiple batches, andnext_scan_completemay return before seeing all of them.Note that this also removes a few assertions which were ensuring that, on start, a worktree's file handle wouldn't know its deleted status, even if the file didn't exist for sure on disk. However, now that
fileis an async API, it's possible that by the time theFileHandleis resolved,Worktreehas already completed scanning. We test a similar behavior further along in the test where those assertions were removed, so it felt okay to proceed without them.