Permalink
Browse files

Reset heartbeat timer when test files are served.

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...
1 parent fe4a563 commit afe8c57e3834eb774361117127c4753185a6cad4 @reid reid committed Aug 23, 2012
Showing with 14 additions and 6 deletions.
  1. +14 −6 lib/hub/batch.js
View
@@ -201,14 +201,16 @@ Batch.prototype.getFile = function (filename, cb) {
};
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) {
if (err) {
- var agent,
- fileInBatch;
- if (agentId) {
- agent = batch.agents[agentId];
- }
+ var fileInBatch;
if (agent) {
// If this file is in the current test batch,
// redirect to the next test.
@@ -238,6 +240,12 @@ Batch.prototype.handleFileRequest = function (server, agentId, filename) {
}
return;
}
+
+ if (agent) {
+ batch.debug("Recording ping for agentId =", agentId, "for file =", filename);
+ agent.ping();
+ }
+
batch.testServer.serve(server, filename, buffer);
});
};

0 comments on commit afe8c57

Please sign in to comment.