Fix #3483 Updater now streams files one-by-one, skipping non-source dirs#3630
Open
ottenhoff wants to merge 5 commits intodenoland:mainfrom
Open
Fix #3483 Updater now streams files one-by-one, skipping non-source dirs#3630ottenhoff wants to merge 5 commits intodenoland:mainfrom
ottenhoff wants to merge 5 commits intodenoland:mainfrom
Conversation
…en/large dirs (node_modules, vendor, docs, etc.) to avoid OOMs and hangs; frees ASTs immediately. - ts-morph dependency bumped to ^27.0.2.
packages/update/src/update.ts
Outdated
Comment on lines
+181
to
+193
| let totalFiles = 0; | ||
| let userFileCount = 0; | ||
| for await ( | ||
| const entry of walk(dir, { | ||
| includeDirs: false, | ||
| includeFiles: true, | ||
| exts: ["js", "jsx", "ts", "tsx"], | ||
| skip: [SKIP_DIRS], | ||
| }) | ||
| ) { | ||
| totalFiles++; | ||
| if (!HIDE_FILES.test(entry.path)) userFileCount++; | ||
| } |
Collaborator
There was a problem hiding this comment.
Let's store the found paths, so that we don't need to walk the file system again a second time.
Author
There was a problem hiding this comment.
Agreed. I just pushed a new commit.
…again a second time
| const HIDE_FILES = /[\\/]+(node_modules|vendor)[\\/]+/; | ||
| // Directories we should completely skip when walking the tree. This keeps us | ||
| // from loading vendored dependencies (often thousands of files) into ts-morph. | ||
| const SKIP_DIRS = |
Collaborator
There was a problem hiding this comment.
What's the difference between HIDE_FILES and SKIP_DIRS? Aren't both used for the same thing? Let's unify that.
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.
Fix system crash (OOM) caused by updater spending time in folders like docs/