Skip to content

refactor: Drop graceful-fs#1676

Open
kitten wants to merge 3 commits intofacebook:mainfrom
kitten:@kitten/refactor/metro-file-map/drop-graceful-fs-and-simplify
Open

refactor: Drop graceful-fs#1676
kitten wants to merge 3 commits intofacebook:mainfrom
kitten:@kitten/refactor/metro-file-map/drop-graceful-fs-and-simplify

Conversation

@kitten
Copy link
Copy Markdown
Contributor

@kitten kitten commented Apr 7, 2026

Summary

Note: This PR is a proposal, but if there's existing/known issues with works around re. EMFILE then it'll likely need further changes.

This removes graceful-fs which doesn't seem to see much use in the codebase anymore and is only being used in a handful of places.

Dropping it in the Node crawler in metro-file-map doesn't seem to have an observable effect. The amount of file handles in this phase should be limited, and it doesn't seem to do us much good to limit this further. If needed, we could limit the amount of readdir calls that are run in parallel instead.

Dropping it in metro itself means that _processSourceRequest won't retry internally on EMFILE errors. However, as this also isn't done elsewhere and graceful-fs is only used for the single createReadStream call here, it doesn't seem to be crucial to keep.

Changelog: [Internal] Remove graceful-fs

Test plan

  • Existing tests should pass unchanged

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 7, 2026
@facebook-github-tools facebook-github-tools bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Apr 7, 2026
kitten added 3 commits April 11, 2026 13:54
This does have the trade-off that EMFILEs in `_processSourceRequest`
in `metro/src/Server.js` won't be retried anymore. This is probably
a fair trade-off since the EMFILE issue isn't handled elsewhere.
@kitten kitten force-pushed the @kitten/refactor/metro-file-map/drop-graceful-fs-and-simplify branch from c3eb777 to a56223f Compare April 11, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant