-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
fs: improve error performance of fchownSync
#49920
base: main
Are you sure you want to change the base?
Conversation
Fixed error by moving validation back to |
Hey @evelez7, can you handle the conflicts? You'll see that |
77696fa
to
8a4d9f3
Compare
@evelez7 Your changes include the fs/sync.js file. Can you remove it? |
Sorry about that, thought it was removed in the rebase. |
try { | ||
return fs.openSync(x, 'r'); | ||
} catch { | ||
return 1 << 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this only be part of the non-existing
case?
int err = uv_fs_fchown(nullptr, &req, fd, uid, gid, nullptr); | ||
FS_SYNC_TRACE_END(fchown); | ||
if (err < 0) { | ||
return env->ThrowUVException(err, "fchown"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need a new binding, it can just be done by switching SyncCall
to SyncCallAndThrowOnError
in the original FChownSync
implementation.
This needs a rebase. |
Credit to @CanadaHonk for the benchmark using file descriptors.
Ref: nodejs/performance#106