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(); }