From 2fa70eae86c5a768e39f3701ae69cab5848c9440 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Tue, 2 Jan 2018 20:58:35 -0500 Subject: [PATCH] benchmark: fix timeout bug in write-stream-throughput --- 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 c61b5900111411..08f059156f2cd9 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -41,10 +41,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); @@ -66,6 +62,10 @@ function main(conf) { if (!started) { started = true; + setTimeout(function() { + ending = true; + f.end(); + }, dur * 1000); bench.start(); }