Files
anonymous_github/test/fixtures/performance-cache-worker.js
T
Thomas Durieux 6434337923 perf: bound request work and resource usage (#866)
* perf: bound request work and resource usage

* fix: address performance review regressions

* fix: guard content expiration and dashboard state

* fix: tolerate cache outages and retire derived paths

* fix: revalidate expiration claims and status pagination

* fix: retry interrupted repository metadata cleanup

* fix: retire obsolete content cache storage

* fix: activate tree metadata and recheck expiration claims

* fix: fence cache publication across expiration

* fix: recover staged trees and enforce cache lifecycle cleanup

* fix: prune expired transforms during database outages

* fix: finish conference removals and reload expiration candidates
2026-10-08 03:38:19 +01:00

24 lines
1.2 KiB
JavaScript

const process = require("node:process");
const { Readable } = require("node:stream");
const { setTimeout: delay } = require("node:timers/promises");
require("ts-node/register/transpile-only");
const GitHubStream = require("../../src/core/source/GitHubStream").default;
const source = new GitHubStream({ repoId: "replicas", organization: "owner", repoName: "repo", commit: "commit",
cacheGeneration: process.env.TEST_GENERATION || "generation1", getToken: () => "token" });
source.downloadWithFallback = async () => {
process.send({ producer: true });
return Readable.from((async function* () {
yield Buffer.from("complete "); await delay(200); yield Buffer.from("content");
})());
};
process.once("message", async () => {
try {
const contents = await Promise.all(Array.from({ length: 5 }, async () => {
const input = await source.getFileContentCache("file.txt", "replicas", () => ({ sha: "blob", size: 16 }));
let text = ""; for await (const chunk of input) text += chunk; return text;
}));
process.send({ contents }); process.exit(0);
} catch (error) { process.send({ error: error.message }); process.exit(1); }
});
process.send({ ready: true });