Skip to content

Commit 2adf4e7

Browse files
santigimenotargos
authored andcommitted
test: fix flaky test-perf-hooks-histogram
Make sure the histogram containing event loop delay info is posted only when at least one datapoint is collected. Fixes: #43503 PR-URL: #43567 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 508cbbc commit 2adf4e7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/parallel/test-perf-hooks-histogram.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ const { inspect } = require('util');
8989
strictEqual(data.enable, undefined);
9090
mc.port1.close();
9191
});
92-
setTimeout(() => mc.port2.postMessage(e), 100);
92+
const interval = setInterval(() => {
93+
if (e.count > 0) {
94+
clearInterval(interval);
95+
mc.port2.postMessage(e);
96+
}
97+
}, 50);
9398
}
9499

95100
{

0 commit comments

Comments
 (0)