Closed znarf closed 4 years ago
We absolutely can’t use synchronous fs methods. They block event loop.
Ensure you add tests to the feature. Tests must fail before your commits and pass after.
@paullmilr
We absolutely can’t use synchronous fs methods. They block event loop.
Would you be fine if I refactor these parts using async/await ?
Sure.
Also, ensure the performance isn’t degrading by 50% or so. The library is used by millions of folks.
For example, the behavior should probably only be used for followSymlinks option
Also, ensure the performance isn’t degrading by 50% or so.
Do you have a benchmark to recommend?
For example, the behavior should probably only be used for followSymlinks option
Do you mean lstat: true
? Or should we introduce a more explicit followSymlinks
option?
Note: I've read the documentation but it's actually currently unclear to me what is the exact purpose of lstat: true
, symlinks
seems to be returned just fine without it.
node examples/bench.js
Try your case with lstat: true and see what happens.
node examples/bench.js
Cool, no regression but more files are being returned. Makes sense, because the symlinked directories are now followed.
Try your case with
{lstat: true}
and see what happens.
I tried and haven't seen a difference regarding symlinks. In the test suite (old test and new test), the symlinks are properly followed without setting this option. Maybe a relic of the past?
If you don't want the symlinks to be followed, I suggest to add an explicit followSymlinks
as a boolean. Should I do that, default to true
?
Except that, the PR is ready for review, refactored using async/await and added a test. The test was properly failing in CI, see https://github.com/paulmillr/readdirp/pull/152.
@paulmillr what do you think? could you review so we can move forward with that?
Some context about this change: I'm proposing to integrate readdirp
in a nice other open source project and this issue is currently a blocker, ref https://github.com/depcheck/depcheck/pull/498
@znarf I will test this on my machine(s) and merge ASAP. Overall, looks good!
Any luck? :-)
Merged. Thank you. Required an adjustment to fix error when the result path doesn't exist.
@paulmillr Excellent! Thank you.
Fix https://github.com/paulmillr/readdirp/issues/150