Skip to content

Commit

Permalink
Lint batch module.
Browse files Browse the repository at this point in the history
  • Loading branch information
reid committed Mar 8, 2012
1 parent 4d778eb commit 326e855
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/hub/batch.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function Batch(manager, id, session, tests, useProxy) {


this.testServer = new TestServer( this.testServer = new TestServer(
'<script src="/socket.io/socket.io.js"></script>' + '<script src="/socket.io/socket.io.js"></script>' +
'<script src="/public/inject.js"></script>'); '<script src="/public/inject.js"></script>'
);


EventEmitter2.call(this); EventEmitter2.call(this);


Expand Down Expand Up @@ -108,13 +109,12 @@ Batch.prototype.dispatch = function () {
// Freeze the current available agents. // Freeze the current available agents.
// TODO: Only select agents asked for. // TODO: Only select agents asked for.


var agents = this.manager.agentManager.getAgents(); var agents = this.manager.agentManager.getAgents(),
urls = [],
self = this;


this.manager.lockAgents(this.id, agents); this.manager.lockAgents(this.id, agents);


var urls = [],
self = this;

if (self.useProxy) { if (self.useProxy) {
self.tests.forEach(function (test) { self.tests.forEach(function (test) {
urls.push("/batch/" + self.id + "/test/" + test); urls.push("/batch/" + self.id + "/test/" + test);
Expand Down Expand Up @@ -151,10 +151,12 @@ Batch.prototype.handleFileRequest = function (server, filename) {
if (agentId) { if (agentId) {
agent = batch.agents[agentId]; agent = batch.agents[agentId];
} }
/*
if (agent) { if (agent) {
// TODO: Advance to next test with 302 Found. // TODO: Advance to next test with 302 Found.
// Emit error for CLI. // Emit error for CLI.
} }
*/


server.res.writeHead(500, { server.res.writeHead(500, {
"content-type": "text/plain" "content-type": "text/plain"
Expand Down Expand Up @@ -215,12 +217,14 @@ BatchManager.prototype.getBatch = function (id) {
}; };


BatchManager.prototype.getBatchByAgent = function (agentId) { BatchManager.prototype.getBatchByAgent = function (agentId) {
var batchId = this.batchAgent[agentId]; var batch = false,
batchId = this.batchAgent[agentId];

if (batchId) { if (batchId) {
return this.batches[batchId]; batch = this.batches[batchId];
} else {
return false;
} }

return batch;
}; };


// Called by the Batch itself // Called by the Batch itself
Expand Down

0 comments on commit 326e855

Please sign in to comment.