-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
timers: clean up, async integration for unref, simplify clearTimeout #18579
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
Conversation
A recent commit removed the usage of the second argument of tryOnTimeout but left the definition in place. Remove it.
It's possible for user-code to flip an existing timeout to be an interval during its execution, in which case the current code would crash due to start being undefined. Fix this by providing a default start value within rearm.
When async hooks integration for Timers was introduced, it was not included in the code for unref'd or subsequently ref'd timers which means those timers only have Timerwrap hooks.
Remove unnecessary condition from timeout & interval clearing.
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.
LGTM. This does not surprise me, considering the my other PR in the same area.
Good work!
A recent commit removed the usage of the second argument of tryOnTimeout but left the definition in place. Remove it. PR-URL: #18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
It's possible for user-code to flip an existing timeout to be an interval during its execution, in which case the current code would crash due to start being undefined. Fix this by providing a default start value within rearm. PR-URL: #18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
When async hooks integration for Timers was introduced, it was not included in the code for unref'd or subsequently ref'd timers which means those timers only have Timerwrap hooks. PR-URL: #18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Remove unnecessary condition from timeout & interval clearing. PR-URL: #18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Should this be backported to |
A recent commit removed the usage of the second argument of tryOnTimeout but left the definition in place. Remove it. PR-URL: nodejs#18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
It's possible for user-code to flip an existing timeout to be an interval during its execution, in which case the current code would crash due to start being undefined. Fix this by providing a default start value within rearm. PR-URL: nodejs#18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
When async hooks integration for Timers was introduced, it was not included in the code for unref'd or subsequently ref'd timers which means those timers only have Timerwrap hooks. PR-URL: nodejs#18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Remove unnecessary condition from timeout & interval clearing. PR-URL: nodejs#18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Should this be backported to |
Assorted, small changes to timers:
A recent commit removed the usage of the second argument of
tryOnTimeout
but left the definition in place. Remove it.It's possible for user-code to flip an existing timeout to be an interval during its execution, in which case the current code would crash due to
start
being undefined. Fix this by providing a defaultstart
value withinrearm
.When async hooks integration for Timers was introduced, it was not included in the code for unref'd or subsequently ref'd timers which means those timers only have TIMERWRAP hooks.
Remove dead code from timeout & interval clearing —
timer[kOnTimeout]
is not something that can exist, askOnTimeout
only exists onTimerWrap
.The first two commits are semver-major as they rely on several prior semver-major PRs, the other two can both go into 8.x & 9.x and I will handle back-porting these sometime later this month.
Benchmark results:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
timers, test