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/node#43503

PR-URL: nodejs/node#43567
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
santigimeno authored and guangwong committed Oct 10, 2022
1 parent 7098540 commit 579fae8
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 579fae8

Please sign in to comment.