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: #43503

PR-URL: #43567
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
santigimeno authored and targos committed Jul 31, 2022
1 parent b62574c commit 9bc4ad0
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 9bc4ad0

Please sign in to comment.