mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
2930bd1317
Refactor Timers to behave more similarly to Immediates by having a single uv_timer_t handle which is stored on the Environment. No longer expose timers in a public binding and instead make it part of the internalBinding. PR-URL: https://github.com/nodejs/node/pull/20894 Fixes: https://github.com/nodejs/node/issues/10154 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
33 lines
743 B
JavaScript
33 lines
743 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const initHooks = require('./init-hooks');
|
|
const verifyGraph = require('./verify-graph');
|
|
const TIMEOUT = 1;
|
|
|
|
const hooks = initHooks();
|
|
hooks.enable();
|
|
|
|
setTimeout(common.mustCall(ontimeout), TIMEOUT);
|
|
function ontimeout() {
|
|
setTimeout(onsecondTimeout, TIMEOUT + 1);
|
|
}
|
|
|
|
function onsecondTimeout() {
|
|
setTimeout(onthirdTimeout, TIMEOUT + 2);
|
|
}
|
|
|
|
function onthirdTimeout() {}
|
|
|
|
process.on('exit', onexit);
|
|
|
|
function onexit() {
|
|
hooks.disable();
|
|
verifyGraph(
|
|
hooks,
|
|
[ { type: 'Timeout', id: 'timeout:1', triggerAsyncId: null },
|
|
{ type: 'Timeout', id: 'timeout:2', triggerAsyncId: 'timeout:1' },
|
|
{ type: 'Timeout', id: 'timeout:3', triggerAsyncId: 'timeout:2' }]
|
|
);
|
|
}
|