Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed runMultiple

  • Loading branch information...
commit 29e1b15ddfe446f50da37e2a942147ee982765da 1 parent 9d34d9a
@penartur authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/benchmark.js
View
13 lib/benchmark.js
@@ -194,10 +194,17 @@ BenchmarkContext.prototype.run = function () {
metaQueue.go();
};
+Benchmark.prototype.doRun = function (simultaneousRequests, callback, over) {
+ var context = new BenchmarkContext(this, simultaneousRequests, callback);
+ context.run(function (simultaneousRequests, stats) {
+ callback(simultaneousRequests, stats);
+ over();
+ });
+}
+
//callback is function(simultaneousRequests, stats)
Benchmark.prototype.run = function (simultaneousRequests, callback) {
- var context = new BenchmarkContext(this, simultaneousRequests, callback);
- context.run(callback);
+ this.doRun(simultaneousRequests, callback, function () { });
}
//callback is function(simultaneousRequests, stats)
@@ -205,7 +212,7 @@ Benchmark.prototype.runMultiple = function (simultaneousRequestsList, callback,
var queue = new WorkingQueue(1);
queue.hold();
for (var i in simultaneousRequestsList) {
- queue.perform(this.run.bind(this), simultaneousRequestsList[i]);
+ queue.perform(this.doRun.bind(this), simultaneousRequestsList[i], callback);
}
queue.whenDone(done);
queue.go();
Please sign in to comment.
Something went wrong with that request. Please try again.