diff --git a/build/lib/fetch.js b/build/lib/fetch.js index 31a3447982d..4f7af522b5b 100644 --- a/build/lib/fetch.js +++ b/build/lib/fetch.js @@ -47,7 +47,10 @@ async function fetchUrl(url, options, retries = 10, retryDelay = 1000) { startTime = new Date().getTime(); } const controller = new AbortController(); - const timeout = setTimeout(() => controller.abort(), 30 * 1000); + // --- Start Positron --- + const timeoutSeconds = options.timeoutSeconds ?? 30; + const timeout = setTimeout(() => controller.abort(), timeoutSeconds * 1000); + // --- End Positron --- try { const response = await fetch(url, { ...options.nodeFetchOptions, diff --git a/build/lib/fetch.ts b/build/lib/fetch.ts index 200e9b3e7a5..0eed6b0e608 100644 --- a/build/lib/fetch.ts +++ b/build/lib/fetch.ts @@ -20,6 +20,9 @@ export interface IFetchOptions { nodeFetchOptions?: RequestInit; verbose?: boolean; checksumSha256?: string; + // --- Start Positron --- + timeoutSeconds?: number; + // --- End Positron --- } export function fetchUrls(urls: string[] | string, options: IFetchOptions): es.ThroughStream { @@ -58,7 +61,10 @@ export async function fetchUrl(url: string, options: IFetchOptions, retries = 10 startTime = new Date().getTime(); } const controller = new AbortController(); - const timeout = setTimeout(() => controller.abort(), 30 * 1000); + // --- Start Positron --- + const timeoutSeconds = options.timeoutSeconds ?? 30; + const timeout = setTimeout(() => controller.abort(), timeoutSeconds * 1000); + // --- End Positron --- try { const response = await fetch(url, { ...options.nodeFetchOptions, diff --git a/build/lib/quarto.js b/build/lib/quarto.js index 4dd0852ecbe..b872f7d3897 100644 --- a/build/lib/quarto.js +++ b/build/lib/quarto.js @@ -32,6 +32,7 @@ function getQuartoWindows(version) { return (0, fetch_1.fetchUrls)([`${basename}.zip`], { base: getBaseUrl(version), verbose: true, + timeoutSeconds: 90, }) .pipe(unzip()); } @@ -47,6 +48,7 @@ function getQuartoMacOS(version) { return (0, fetch_1.fetchUrls)([`quarto-${version}-macos.tar.gz`], { base: getBaseUrl(version), verbose: true, + timeoutSeconds: 90, }) // Unzip, then untar .pipe(gunzip()) @@ -67,6 +69,7 @@ function getQuartoLinux(version) { return (0, fetch_1.fetchUrls)([`${basename}.tar.gz`], { base: getBaseUrl(version), verbose: true, + timeoutSeconds: 90, }) // Unzip, then untar .pipe(gunzip()) diff --git a/build/lib/quarto.ts b/build/lib/quarto.ts index 555aafc8458..50f2679f3ef 100644 --- a/build/lib/quarto.ts +++ b/build/lib/quarto.ts @@ -32,6 +32,7 @@ function getQuartoWindows(version: string): Stream { return fetchUrls([`${basename}.zip`], { base: getBaseUrl(version), verbose: true, + timeoutSeconds: 90, }) .pipe(unzip()); } @@ -49,6 +50,7 @@ function getQuartoMacOS(version: string): Stream { return fetchUrls([`quarto-${version}-macos.tar.gz`], { base: getBaseUrl(version), verbose: true, + timeoutSeconds: 90, }) // Unzip, then untar .pipe(gunzip()) @@ -72,6 +74,7 @@ function getQuartoLinux(version: string): Stream { return fetchUrls([`${basename}.tar.gz`], { base: getBaseUrl(version), verbose: true, + timeoutSeconds: 90, }) // Unzip, then untar .pipe(gunzip())