Skip to content

Commit

Permalink
test: fix flaky test-perf-hooks-histogram
Browse files Browse the repository at this point in the history
Make sure the histogram containing event loop delay info is posted only
when at least one datapoint is collected.

Fixes: nodejs#43503
  • Loading branch information
santigimeno committed Jun 25, 2022
1 parent d96a2ea commit f62f7bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/parallel/test-perf-hooks-histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ const { inspect } = require('util');
strictEqual(data.enable, undefined);
mc.port1.close();
});
setTimeout(() => mc.port2.postMessage(e), 100);
const interval = setInterval(() => {
if (e.count > 0) {
clearInterval(interval);
mc.port2.postMessage(e);
}
}, 50);
}

{
Expand Down

0 comments on commit f62f7bf

Please sign in to comment.