Skip to content

Commit

Permalink
TINY-11177: Increase sticky timeout to 55 seconds, and try to make ab…
Browse files Browse the repository at this point in the history
…solutely sure it sends a message every 30 seconds
  • Loading branch information
TheSpyder committed Jan 16, 2025
1 parent c525b0b commit 2eceff4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
23 changes: 11 additions & 12 deletions modules/runner/src/main/ts/reporter/Reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const mapError = (e: LoggedError) => mapStackTrace(e.stack).then((mappedStack) =

export const Reporter = (params: UrlParams, callbacks: Callbacks, ui: ReporterUi): Reporter => {
const initial = new Date();
let timeSinceLastReport = initial;
let timeOfLastReport = initial;
let currentCount = params.offset || 0;
let passCount = 0;
let skipCount = 0;
Expand All @@ -64,6 +64,8 @@ export const Reporter = (params: UrlParams, callbacks: Callbacks, ui: ReporterUi
if (testResults.length > 0) {
requestsInFlight.push(callbacks.sendTestResults(params.session, testResults));
testResults.length = 0;
} else {
requestsInFlight.push(callbacks.sendKeepAlive(params.session));
}
};

Expand Down Expand Up @@ -91,10 +93,10 @@ export const Reporter = (params: UrlParams, callbacks: Callbacks, ui: ReporterUi
if (currentCount === 1) {
// we need to send test start once to establish the session
requestsInFlight.push(callbacks.sendTestStart(params.session, currentCount, totalNumTests, file, name));
} else if (starttime.getTime() - timeSinceLastReport.getTime() > 30 * 1000) {
} else if (starttime.getTime() - timeOfLastReport.getTime() > 30 * 1000) {
// ping the server with results every 30 seconds or so, otherwise the result data could be gigantic
sendCurrentResults();
timeSinceLastReport = new Date();
timeOfLastReport = new Date();
}
}
};
Expand Down Expand Up @@ -194,15 +196,12 @@ export const Reporter = (params: UrlParams, callbacks: Callbacks, ui: ReporterUi
// the page is about to reload to retry a test
const retry = (): Promise<void> => {
// remove the last test failure from the stack so we don't confuse the server
return Promise.all(requestsInFlight).then(() => {
const last = testResults.pop();
if (last && last.error === null) {
// something isn't right, the last test didn't fail, put it back
testResults.push(last);
}
// now push the results to the server
return waitForResults();
});
const last = testResults.pop();
if (last && last.error === null) {
// something isn't right, the last test didn't fail, put it back
testResults.push(last);
}
return waitForResults();
};

const done = (error?: LoggedError): void => {
Expand Down
4 changes: 2 additions & 2 deletions modules/server/src/main/ts/bedrock/server/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ export const create = (stickyFirstSession: boolean, overallTimeout: number, test
}
clearInterval(poller);
} else {
if (now - session.updated > 50 * 1000) {
if (now - session.updated > 55 * 1000) {
// sticky sessions have longer before they time out, but we still can't sit around if the driver has failed
const message = 'No updates from the browser in 50 seconds, assuming driver has failed.';
const message = 'No updates from the browser in 55 seconds, assuming driver has failed.';
reject({message, results, start, now});
clearInterval(poller);
timeoutError = true;
Expand Down

0 comments on commit 2eceff4

Please sign in to comment.