Skip to content

Conversation

@mcollina
Copy link
Member

@mcollinamcollina commented Jun 5, 2017

#11225 introduce an unnecessary
bind() when closing a stream. This PR replaces that bind() with a
top-level function.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

fs

edit: updated according to @refack suggestion.

@mcollinamcollina requested a review from mscdexJune 5, 2017 14:48
@nodejs-github-botnodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Jun 5, 2017
@mcollina
Copy link
MemberAuthor

cc @mscdex

Copy link
Contributor

@refackrefack left a comment

Choose a reason for hiding this comment

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

So it's not a "useless" bind (it was a Currying null). I'd say you just replaced it with something better.

lib/fs.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can make it more evident by adding an fd parameter here? Plus I'm sure V8 would prefer it.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

updated.

lib/fs.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this be correct here?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

yes, that's the exact meaning. this will be the stream object. I'll add a comment to note that.

Copy link
Contributor

Choose a reason for hiding this comment

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

EventEmitter instances always call their event handlers within the context of the EventEmitter. I'm not sure we need to explicitly document that in this one particular place when we do this same thing throughout core.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @mscdex. I looked at the code too quickly earlier.

@mcollina
Copy link
MemberAuthor

@mscdex
Copy link
Contributor

LGTM

@mcollina
Copy link
MemberAuthor

@refack I've amended the commit message, check if it is ok and I'll merge.

@mcollinamcollina changed the title fs: remove useless bind()fs: replace a bind() with a top-level functionJun 7, 2017
Copy link
Contributor

@refackrefack left a comment

Choose a reason for hiding this comment

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

✔️

nodejs#11225 introduce an unnecessary bind() when closing a stream. This PR replaces that bind() with a top-level function. PR-URL: nodejs#13474 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
@mcollina
Copy link
MemberAuthor

Landed as 07ca288.

@mcollinamcollina closed this Jun 7, 2017
@mcollinamcollina deleted the remove-bind branch June 7, 2017 12:04
mcollina added a commit to mcollina/node that referenced this pull request Jun 7, 2017
nodejs#11225 introduce an unnecessary bind() when closing a stream. This PR replaces that bind() with a top-level function. PR-URL: nodejs#13474 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
jasnell pushed a commit that referenced this pull request Jun 7, 2017
#11225 introduce an unnecessary bind() when closing a stream. This PR replaces that bind() with a top-level function. PR-URL: #13474 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
@gibfahngibfahn mentioned this pull request Jun 15, 2017
3 tasks
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fsIssues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@mcollina@mscdex@MylesBorins@refack@jasnell@evanlucas@lpinca@cjihrig@nodejs-github-bot