mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 17:57:53 +00:00

Hang all timer lists off a single TimerWrap and use the PriorityQueue to manage expiration priorities. This makes the Timers code clearer, consumes significantly less resources and improves performance. PR-URL: https://github.com/nodejs/node/pull/20555 Fixes: https://github.com/nodejs/node/issues/16105 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
16 lines
495 B
JavaScript
16 lines
495 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
// This test documents an internal implementation detail of the Timers:
|
|
// since timers of different durations are stored in separate lists,
|
|
// a nextTick queue will clear after each list of timers. While this
|
|
// behaviour is not documented it could be relied on by Node's users.
|
|
|
|
setTimeout(common.mustCall(() => {
|
|
process.nextTick(() => { clearTimeout(t2); });
|
|
}), 1);
|
|
const t2 = setTimeout(common.mustNotCall(), 2);
|
|
|
|
common.busyLoop(5);
|