Permalink
Browse files

Fixed runMultiple

  • Loading branch information...
1 parent 9d34d9a commit 29e1b15ddfe446f50da37e2a942147ee982765da @penartur committed May 4, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/benchmark.js
View
@@ -194,18 +194,25 @@ 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)
Benchmark.prototype.runMultiple = function (simultaneousRequestsList, callback, done) {
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();

0 comments on commit 29e1b15

Please sign in to comment.