-
Notifications
You must be signed in to change notification settings - Fork 30k
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
node: set process._eventsCount to 0 on startup #5208
Conversation
Can we just call constructor from JS side? |
LGTM |
@vkurchatkin we certainly could. I played with it and didn't see any difference in performance. Any particular reason you would prefer that? |
LGTM |
@@ -18,3 +18,6 @@ process.on('SIGPIPE', common.mustCall((data) => { | |||
process.emit('normal', 'normalData'); | |||
process.emit(sym, 'symbolData'); | |||
process.emit('SIGPIPE', 'signalData'); | |||
|
|||
assert.strictEqual(typeof process._eventsCount, 'number'); | |||
assert.strictEqual(isNaN(process._eventsCount), false); |
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.
Both these tests can be combined with Number.isNaN
That would be my suggestion as well. Aside, if |
867fbf8
to
3589630
Compare
Ok, changed to set on the JS side. Also fixed up the test per @thefourtheye. CI: https://ci.nodejs.org/job/node-test-pull-request/1657/ Thanks! |
@@ -18,3 +18,5 @@ process.on('SIGPIPE', common.mustCall((data) => { | |||
process.emit('normal', 'normalData'); | |||
process.emit(sym, 'symbolData'); | |||
process.emit('SIGPIPE', 'signalData'); | |||
|
|||
assert.strictEqual(Number.isNaN(process._eventsCount), false); |
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 you use global isNaN()
here? Number.isNaN('boom')
would pass because it returns false.
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.
ah good catch. fixing
3589630
to
ee4f272
Compare
Fixed Ben's comment. |
LGTM |
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: nodejs#5208 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
ee4f272
to
31ebda2
Compare
Landed in 31ebda2. Thanks! |
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: #5208 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: nodejs#5208 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: #5208 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: #5208 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: #5208 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
process
is anEventEmitter
. There are operations that increment anddecrement the
_eventsCount
property of anEventEmitter
.process._eventsCount
would previously get set toNaN
. This change makesprocess._eventsCount
be calculated as expected.