Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tools/respecDocWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import { readFile } from "fs/promises";

const noop = () => {};

/**
* Time allowed for the browser process to start, separate from processing.
* Cold CI runners regularly need longer than puppeteer's 30s default,
* which surfaced as "Timed out ... waiting for the WS endpoint URL".
*/
const LAUNCH_TIMEOUT = 120000;

/**
* Fetches a ReSpec "src" URL, and writes the processed static HTML to an "out" path.
* @param {string} src A URL or filepath that is the ReSpec source.
Expand Down Expand Up @@ -41,7 +48,11 @@ export async function toHTML(src, options = {}) {
}

const log = msg => options.onProgress(msg, timer.remaining);
const timer = createTimer(timeout);
/**
* Starts once the browser is up, so a slow launch does not eat the caller's
* processing budget. `timeout` documents time before *processing* times out.
*/
let timer = createTimer(timeout);

/** @type {RsError[]} */
const errors = [];
Expand All @@ -65,7 +76,10 @@ export async function toHTML(src, options = {}) {
args,
devtools,
headless: true,
timeout: LAUNCH_TIMEOUT,
});
// Charge only document processing against the caller's timeout.
timer = createTimer(timeout);

try {
const page = await browser.newPage();
Expand Down