From 6f33953d9022d3066ef6ac9d2378ae51d16102ba Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Tue, 2 Jan 2018 20:58:35 -0500 Subject: [PATCH] benchmark: fix timeout in write-stream-throughput PR-URL: https://github.com/nodejs/node/pull/17958 Fixes: https://github.com/nodejs/node/issues/17901 Reviewed-By: James M Snell Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- benchmark/fs/write-stream-throughput.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index 812dc369d7b5b3..432748f996abb2 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -40,10 +40,6 @@ function main(conf) { var started = false; var ending = false; var ended = false; - setTimeout(function() { - ending = true; - f.end(); - }, dur * 1000); var f = fs.createWriteStream(filename); f.on('drain', write); @@ -65,6 +61,10 @@ function main(conf) { if (!started) { started = true; + setTimeout(function() { + ending = true; + f.end(); + }, dur * 1000); bench.start(); }