summaryrefslogtreecommitdiff
path: root/lib/timers.js
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2018-02-05 11:19:11 -0500
committerAnatoli Papirovski <apapirovski@mac.com>2018-02-08 09:01:54 -0500
commitc11cb038a116f1097e4f800b6e4471dafce8a46f (patch)
tree2dbeda1260dc43177346ed4fd706872244b2d787 /lib/timers.js
parent568b6a5c9e9893fbb6ab811cfa76841fb3c80a0a (diff)
downloadandroid-node-v8-c11cb038a116f1097e4f800b6e4471dafce8a46f.tar.gz
android-node-v8-c11cb038a116f1097e4f800b6e4471dafce8a46f.tar.bz2
android-node-v8-c11cb038a116f1097e4f800b6e4471dafce8a46f.zip
timers: async track unref timers
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: https://github.com/nodejs/node/pull/18579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/timers.js')
-rw-r--r--lib/timers.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/timers.js b/lib/timers.js
index 4d41b5dc8a..954c73f602 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -289,7 +289,7 @@ TimerWrap.prototype[kOnTimeout] = function listOnTimeout(now) {
// An optimization so that the try/finally only de-optimizes (since at least v8
// 4.7) what is in this smaller function.
-function tryOnTimeout(timer) {
+function tryOnTimeout(timer, start) {
timer._called = true;
const timerAsyncId = (typeof timer[async_id_symbol] === 'number') ?
timer[async_id_symbol] : null;
@@ -297,7 +297,7 @@ function tryOnTimeout(timer) {
if (timerAsyncId !== null)
emitBefore(timerAsyncId, timer[trigger_async_id_symbol]);
try {
- ontimeout(timer);
+ ontimeout(timer, start);
threw = false;
} finally {
if (timerAsyncId !== null) {
@@ -520,7 +520,7 @@ function unrefdHandle(now) {
try {
// Don't attempt to call the callback if it is not a function.
if (typeof this.owner._onTimeout === 'function') {
- ontimeout(this.owner, now);
+ tryOnTimeout(this.owner, now);
}
} finally {
// Make sure we clean up if the callback is no longer a function