From b888bfe81d39a0b528ca371c7fa1376111f9e667 Mon Sep 17 00:00:00 2001 From: Brian White Date: Sat, 31 Dec 2016 16:30:05 -0500 Subject: benchmark: allow zero when parsing http req/s Without this, the http benchmarker would report "strange output" if wrk or any other http client reported 0 requests per second, which is a valid result. PR-URL: https://github.com/nodejs/node/pull/10558 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Evan Lucas --- benchmark/_http-benchmarkers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'benchmark/_http-benchmarkers.js') diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js index e096efc71b..235d5d0786 100644 --- a/benchmark/_http-benchmarkers.js +++ b/benchmark/_http-benchmarkers.js @@ -61,7 +61,7 @@ WrkBenchmarker.prototype.create = function(options) { WrkBenchmarker.prototype.processResults = function(output) { const match = output.match(this.regexp); const result = match && +match[1]; - if (!result) { + if (!isFinite(result)) { return undefined; } else { return result; @@ -126,7 +126,7 @@ exports.run = function(options, callback) { } const result = benchmarker.processResults(stdout); - if (!result) { + if (result === undefined) { callback(new Error(`${options.benchmarker} produced strange output: ` + stdout, code)); return; -- cgit v1.2.3