Skip to content

Commit

Permalink
Reset heartbeat timer when test files are served.
Browse files Browse the repository at this point in the history
The heartbeat timer is only reset when YUI Test reports
a test pass or fail event. If a test fails to run any YUI Tests
before the heartbeat timeout of 45 seconds, then future tests
will immediately hit this timeout because the timeout is not
cleared when a new test is requested.

This fix causes the timer to reset when test-related files
are served, which includes requesting a new test.

Credit to John Traver <jtraver@yahoo-inc.com> for
reporting this issue.
  • Loading branch information
reid committed Aug 23, 2012
1 parent fe4a563 commit afe8c57
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/hub/batch.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -201,14 +201,16 @@ Batch.prototype.getFile = function (filename, cb) {
}; };


Batch.prototype.handleFileRequest = function (server, agentId, filename) { Batch.prototype.handleFileRequest = function (server, agentId, filename) {
var batch = this; var agent,
batch = this;

if (agentId) {
agent = batch.agents[agentId];
}

this.getFile(filename, function (err, buffer) { this.getFile(filename, function (err, buffer) {
if (err) { if (err) {
var agent, var fileInBatch;
fileInBatch;
if (agentId) {
agent = batch.agents[agentId];
}
if (agent) { if (agent) {
// If this file is in the current test batch, // If this file is in the current test batch,
// redirect to the next test. // redirect to the next test.
Expand Down Expand Up @@ -238,6 +240,12 @@ Batch.prototype.handleFileRequest = function (server, agentId, filename) {
} }
return; return;
} }

if (agent) {
batch.debug("Recording ping for agentId =", agentId, "for file =", filename);
agent.ping();
}

batch.testServer.serve(server, filename, buffer); batch.testServer.serve(server, filename, buffer);
}); });
}; };
Expand Down

0 comments on commit afe8c57

Please sign in to comment.