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

VsChromium sometimes rescan files too many times in a row #36

Closed
rpaquay opened this issue Aug 7, 2017 · 1 comment
Closed

VsChromium sometimes rescan files too many times in a row #36

rpaquay opened this issue Aug 7, 2017 · 1 comment

Comments

@rpaquay
Copy link
Contributor

rpaquay commented Aug 7, 2017

This is related to issue #35.

VsChromium has 2 main components for synchronizing its index: one component keeps track of the file system structure (list of files and directories) and another keeps track of the contents of these files.

Both of these components run potentially long running file system operations on separate threads, serialized via a queue. This means there is a guarantee that file system scans never run concurrently (that would be sub-efficient as it would merely increase i/o latency). However, these long running tasks don't currently support cancellation, meaning that VsChromium can end up enqueuing tasks that will essentially perform a similar operation as the currently running one.

It would be more efficient to be able to cancel the currently running task when enqueuing a new task that will provide a similar (but more up to date) result.

Corner case scenario:

  • Open a "vs-chromium-project.txt" file in VS
  • A file system scan immediately starts (to discover files in that directory)
  • Quickly close the "vs-chromium-project.txt" file
  • The file system scan keeps going (because even though there is nothing to scan, the currently running task is not cancelled)

Ideally, the file system scan would be cancelled soon after the "vs-chromium-project.txt" file is closed.

Note that this is only visible for large projects, such as Chromium enlistments, that contains thousands of directories and files.

@rpaquay
Copy link
Contributor Author

rpaquay commented Aug 7, 2017

Note the same issue applies to the file contents loading components: its long running tasks should be cancellable.

rpaquay added a commit that referenced this issue Aug 8, 2017
* A CancellationToken is used to cancel a currently file system scan
  operation if a new one if scheduled.

* Various other minor code refactoring/cleanup

This is a partial (more to come) fix for issue #36.
rpaquay added a commit that referenced this issue Aug 8, 2017
This is a partial (more to come) fix for issue #36.
rpaquay added a commit that referenced this issue Aug 8, 2017
This ensures that the tasks to rescan the file system and to load
file contents don't overlap.

This is the final fix for bugs #35 and #36.
@rpaquay rpaquay closed this as completed Dec 22, 2017
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

No branches or pull requests

1 participant