blob: 8aa46ab07b54712ac35497e36ce0bc3e56a41299 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
'use strict';
const common = require('../common');
const initHooks = require('./init-hooks');
const verifyGraph = require('./verify-graph');
const TIMEOUT = 1;
const hooks = initHooks();
hooks.enable();
let count = 0;
const iv1 = setInterval(common.mustCall(onfirstInterval, 3), TIMEOUT);
let iv2;
function onfirstInterval() {
if (++count === 3) {
clearInterval(iv1);
iv2 = setInterval(common.mustCall(onsecondInterval, 1), TIMEOUT + 1);
}
}
function onsecondInterval() {
clearInterval(iv2);
}
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' }]
);
}
|