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

Update collectFshFilesForPath to not check the same folder multiple times #99

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

ethanjdiamond
Copy link
Contributor

Description:
The FSH extension was causing pretty bad CPU issues for my team. We work in a monorepo using pnpm workspaces, which means that all our packages, internal and external, are linked using symlinks in node_modules. The "find the fsh files in workspace" step didn't have logic to prevent the same folders from being repeatedly checked for every time they're added as a dependency to another package.

This PR does two things - 1) use realpath in fs, which will resolve symlink paths, and 2) keeps track of all the realpaths that have been visited and do an immediate return if the folder has been visited before. This should fix our issue.

Testing Instructions:
It passes the previously existing tests and returns the proper .fsh files.

Related Issue:
N/A

@ethanjdiamond
Copy link
Contributor Author

@jafeltra Do you mind taking a look at this? Thanks!

@cmoesel
Copy link
Member

cmoesel commented Oct 20, 2024

Hi @ethanjdiamond. We just started a new sprint on Friday and I asked @mint-thompson to take the lead on reviewing this. I expect they will look at it soon! Thank you for the contribution!

Copy link
Collaborator

@mint-thompson mint-thompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening this PR. I'm getting the expected behavior when running this on my system, and I've confirmed that the tests pass. This looks like an excellent update to help improve performance.

Copy link
Collaborator

@jafeltra jafeltra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This update looks like a helpful improvement! Thanks for the contribution!

@jafeltra jafeltra merged commit 2eeffc6 into FHIR:master Oct 23, 2024
7 checks passed
@ethanjdiamond
Copy link
Contributor Author

Thank you!

@ethanjdiamond ethanjdiamond deleted the update-find-fsh-files branch October 24, 2024 00:13
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

Successfully merging this pull request may close these issues.

4 participants