Skip to content

Commit 1f10516

Browse files
committed
Add comments
1 parent 6adbfd1 commit 1f10516

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tools/gulp/tasks/screenshots.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ const LOCAL_GOLDENS = path.join(SCREENSHOT_DIR, `golds`);
2626
const LOCAL_DIFFS = path.join(SCREENSHOT_DIR, `diff`);
2727

2828
// Directory to which untrusted screenshot results are temporarily written
29-
// (without authentication required) before they are verified and copied to
30-
// the final storage location.
29+
// (without authentication required) before they are verified and copied to
30+
// the final storage location.
3131
const TEMP_FOLDER = 'untrustedInbox';
3232
const FIREBASE_REPORT = `${TEMP_FOLDER}/screenshot/reports`;
3333
const FIREBASE_IMAGE = `${TEMP_FOLDER}/screenshot/images`;
3434
const FIREBASE_DATA_GOLDENS = `screenshot/goldens`;
3535
const FIREBASE_STORAGE_GOLDENS = 'goldens';
3636

37+
/** Time in ms until the process will be exited if the last action took too long (6 minutes). */
3738
const lastActionTimeout = 1000 * 60 * 6;
39+
40+
/** Time in ms that specifies how often the last action should be checked (45 seconds). */
3841
const lastActionRefreshInterval = 1000 * 45;
3942

4043
/** Task which upload screenshots generated from e2e test. */
@@ -47,19 +50,20 @@ task('screenshots', () => {
4750
} else if (prNumber) {
4851
const firebaseApp = connectFirebaseScreenshots();
4952
const database = firebaseApp.database();
50-
5153
let lastActionTime = Date.now();
5254

53-
// If this task hasn't completed in 8 minutes, close the firebase connection.
55+
// If the last action of the task takes longer than 6 minutes, close the firebase connection.
5456
const timeoutId = setInterval(() => {
5557
if (lastActionTime + lastActionTimeout <= Date.now()) {
5658
clearTimeout(timeoutId);
5759
console.error('Last action for screenshot tests did not finish in ' +
58-
(lastActionTime / 1000 / 60) + ' minutes. Closing Firebase connection...');
60+
(lastActionTimeout / 1000 / 60) + ' minutes. Closing Firebase connection...');
5961
return firebaseApp.delete().then(() => process.exit(1));
6062
}
6163
}, lastActionRefreshInterval);
6264

65+
console.log(` Starting screenshots task with results from e2e task...`);
66+
6367
return uploadTravisJobInfo(database, prNumber)
6468
.then(() => {
6569
console.log(` Downloading screenshot golds from Firebase...`);

0 commit comments

Comments
 (0)