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

net: refactor onSlaveClose in Server.close #12334

Closed

Conversation

claudiorodriguez
Copy link
Contributor

Refactors onSlaveClose in Server.close to be an arrow function,
removes need for self = this and moves it down to make code
more readable.

make bench-net before and after (don't see any significant change):
https://gist.github.com/claudiorodriguez/b3b9483c05bd6c21626c9bcd0bfa7897

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

net

@claudiorodriguez claudiorodriguez added the net Issues and PRs related to the net subsystem. label Apr 11, 2017
lib/net.js Outdated
var left = this._slaves.length;
var onSlaveClose = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use const instead of var here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just following existing style, but yes, of course

Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: nodejs#12334
@claudiorodriguez
Copy link
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/7351/
Also @evanlucas change done, thanks

@claudiorodriguez
Copy link
Contributor Author

Landed in 615167b

claudiorodriguez added a commit that referenced this pull request Apr 18, 2017
Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: #12334
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
evanlucas pushed a commit that referenced this pull request Apr 25, 2017
Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: #12334
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
@evanlucas evanlucas mentioned this pull request May 1, 2017
evanlucas pushed a commit that referenced this pull request May 1, 2017
Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: #12334
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
evanlucas pushed a commit that referenced this pull request May 2, 2017
Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: #12334
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
@gibfahn
Copy link
Member

gibfahn commented May 16, 2017

I backported this to v6.x, let me know if that was a mistake.

gibfahn pushed a commit that referenced this pull request May 16, 2017
Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: #12334
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
MylesBorins pushed a commit that referenced this pull request May 18, 2017
Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: #12334
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
@MylesBorins MylesBorins mentioned this pull request May 23, 2017
andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
Refactors onSlaveClose in Server.close to be an arrow function,
removes need for `self = this` and moves it down to make code
more readable.

PR-URL: nodejs/node#12334
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants