Skip to content

Commit

Permalink
benchmark: allow zero when parsing http req/s
Browse files Browse the repository at this point in the history
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: #10558
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
  • Loading branch information
mscdex committed Jan 11, 2017
1 parent 176cdc2 commit b888bfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b888bfe

Please sign in to comment.