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 <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
pull/10558/head
Brian White 2016-12-31 16:30:05 -05:00
parent 176cdc2823
commit b888bfe81d
No known key found for this signature in database
GPG Key ID: 606D7358F94DA209
1 changed files with 2 additions and 2 deletions

View File

@ -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;