-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Node file crawler - warn and keep going on unreadable directories
Summary: When *not* using Watchman, Metro's "node crawler" exhibits undefined behaviour when it encounters an error reading any directory at or within watched roots. An error from `fs.readdir` results in `callback` being called immediately with whatever files had been read by that point, which is generally non-deterministic due to parallel reads. Moreover, crawling other directories continues and `callback` is invoked *again* when `activeCalls` drops to zero, but this second invocation of `callback` does nothing as by then the wrapping Promise has already fulfilled. Ultimately these errors should probably be fatal, and users should be required to explicitly ignore/not include directories that can't be read (note that `graceful-fs` already ensures we've attempted to retry on typical short-lived issues), but as a first step this non-breaking change warns and skips these directories, allowing the rest of the crawl to complete. Changelog: ``` - **[Fix]**: Node crawler (non-Watchman) returns non-deterministic partial results on silent directory read errors. ``` Reviewed By: motiz88 Differential Revision: D56416365 fbshipit-source-id: aba37f35069ca496b4f6bc2d259b0c179efa2e08
- Loading branch information
1 parent
f5e87eb
commit 105e222
Showing
6 changed files
with
82 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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