Bump high water mark when downloading bundle to 16 MB

This commit is contained in:
Henry Mercer 2024-10-22 19:58:23 +01:00
parent 8c3a732e36
commit 06361b4d2b
6 changed files with 35 additions and 5 deletions

View file

@ -142,6 +142,13 @@ export async function extractTarZst(
logger: Logger,
): Promise<string> {
const dest = await createExtractFolder();
logger.debug(
`Extracting to ${dest}.${
tar instanceof stream.Readable
? ` Input stream has high water mark ${tar.readableHighWaterMark}.`
: ""
}`,
);
try {
// Initialize args

View file

@ -1,4 +1,4 @@
import { IncomingMessage, OutgoingHttpHeaders } from "http";
import { IncomingMessage, OutgoingHttpHeaders, RequestOptions } from "http";
import * as path from "path";
import { performance } from "perf_hooks";
@ -11,6 +11,11 @@ import { formatDuration, Logger } from "./logging";
import * as tar from "./tar";
import { cleanUpGlob } from "./util";
/**
* High watermark to use when streaming the download and extraction of the CodeQL tools.
*/
export const STREAMING_HIGH_WATERMARK_BYTES = 4 * 1024 * 1024; // 4 MiB
/**
* Timing information for the download and extraction of the CodeQL tools when
* we fully download the bundle before extracting.
@ -182,7 +187,14 @@ async function downloadAndExtractZstdWithStreaming(
headers,
);
const response = await new Promise<IncomingMessage>((resolve) =>
https.get(codeqlURL, { headers }, (r) => resolve(r)),
https.get(
codeqlURL,
{
headers,
highWaterMark: STREAMING_HIGH_WATERMARK_BYTES,
} as unknown as RequestOptions,
(r) => resolve(r),
),
);
if (response.statusCode !== 200) {