@alwaysmeticulous/remote-replay-launcher
Advanced tools
Comparing version 2.128.0 to 2.129.0
@@ -13,2 +13,3 @@ "use strict"; | ||
const PROGRESS_UPDATE_INTERVAL_MS = 5000; // 5 seconds | ||
const MS_TO_WAIT_FOR_RETRY = 5 * 60 * 1000; // 5 minutes | ||
const executeRemoteTestRun = async ({ apiToken: apiToken_, appUrl, commitSha, secureTunnelHost, onTunnelCreated, onTestRunCreated, onProgressUpdate, keepTunnelOpenPromise, environment, }) => { | ||
@@ -65,3 +66,16 @@ const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME); | ||
let progressUpdateInterval = undefined; | ||
let startedWaitingForRetryAt = undefined; | ||
const onTestRunCompleted = (completedTestRun) => { | ||
if (completedTestRun.status === "ExecutionError" && | ||
(startedWaitingForRetryAt === undefined || | ||
Date.now() - startedWaitingForRetryAt < MS_TO_WAIT_FOR_RETRY)) { | ||
// It may get re-triggered: let's wait to see if it does: we keep progressUpdateInterval | ||
// so it'll keep polling for updates. Eventually it'll either hit the timeout or the test run | ||
// will move to the Running state again and we'll wait a while more. | ||
if (startedWaitingForRetryAt === undefined) { | ||
startedWaitingForRetryAt = Date.now(); | ||
logger.info(`Test run failed with execution error. Waiting for ${MS_TO_WAIT_FOR_RETRY / 1000} seconds to see if it gets automatically retried...`); | ||
} | ||
return; | ||
} | ||
if (progressUpdateInterval) { | ||
@@ -89,2 +103,6 @@ clearInterval(progressUpdateInterval); | ||
} | ||
else if (startedWaitingForRetryAt !== undefined) { | ||
logger.info(`Retrying test run... (status is now ${updatedTestRun.status})`); | ||
startedWaitingForRetryAt = undefined; | ||
} | ||
}, PROGRESS_UPDATE_INTERVAL_MS); | ||
@@ -91,0 +109,0 @@ const completedTestRun = await testRunCompleted.promise; |
{ | ||
"name": "@alwaysmeticulous/remote-replay-launcher", | ||
"version": "2.128.0", | ||
"version": "2.129.0", | ||
"description": "Executes a remote replay on Meticulous' infrastructure", | ||
@@ -25,3 +25,3 @@ "license": "ISC", | ||
"@alwaysmeticulous/common": "^2.127.0", | ||
"@alwaysmeticulous/tunnels-client": "^2.128.0", | ||
"@alwaysmeticulous/tunnels-client": "^2.129.0", | ||
"loglevel": "^1.8.0" | ||
@@ -63,3 +63,3 @@ }, | ||
}, | ||
"gitHead": "a903dff6f3d8a91915b2110defa15655ee6923dc" | ||
"gitHead": "b6f424996192f616532e657280ac4a42d9af20a2" | ||
} |
Sorry, the diff of this file is not supported yet
15606
186