fix: bump HEIF + image-enhancement CI timeout to 300s

HEIF decoding combined with image-enhancement (CLAHE + histogram +
multi-step corrections) exceeds 180s on GitHub Actions runners.
HEIC works fine (~4.5s) but HEIF specifically needs ~5min in CI.
This commit is contained in:
SnapOtter
2026-05-09 19:52:11 +08:00
parent db34157bcb
commit d2f5456624
3 changed files with 27 additions and 19 deletions
@@ -189,6 +189,8 @@ function needsFallback(fmt: FormatDef): boolean {
}
function getTimeout(fmt: FormatDef, toolId?: string): number | undefined {
if ((fmt.needsHeifDecoder || fmt.needsCliDecoder) && toolId === "image-enhancement")
return 300_000;
if (fmt.needsHeifDecoder || fmt.needsCliDecoder) return 180_000;
if (toolId === "image-enhancement") return 120_000;
return undefined;
@@ -1051,22 +1053,26 @@ describe("HEIC/HEIF graceful handling", () => {
for (const fmt of HEIF_FORMATS) {
describe(`${fmt.name}`, () => {
for (const tool of CORE_TOOLS) {
it(`${tool.id}: no crash`, async () => {
const res = await callTool(tool.id, fmt, tool.settings);
if (!res) return;
it(
`${tool.id}: no crash`,
async () => {
const res = await callTool(tool.id, fmt, tool.settings);
if (!res) return;
// Must never crash
expect(res.statusCode).not.toBe(500);
// Must never crash
expect(res.statusCode).not.toBe(500);
// Accept success (200) or clean error (400/422)
expect([200, 400, 422]).toContain(res.statusCode);
// Accept success (200) or clean error (400/422)
expect([200, 400, 422]).toContain(res.statusCode);
const body = JSON.parse(res.body);
if (res.statusCode !== 200) {
expect(body.error).toBeDefined();
expect(typeof body.error).toBe("string");
}
}, 180_000);
const body = JSON.parse(res.body);
if (res.statusCode !== 200) {
expect(body.error).toBeDefined();
expect(typeof body.error).toBe("string");
}
},
tool.id === "image-enhancement" ? 300_000 : 180_000,
);
}
});
}
+7 -5
View File
@@ -485,11 +485,13 @@ describe("Cross-format matrix", () => {
if (tool.id === "convert" && fmt.name === "PNG") continue;
const perTestTimeout =
fmt.needsHeifDecoder || fmt.needsCliDecoder
? 180_000
: tool.id === "image-enhancement"
? 120_000
: undefined;
(fmt.needsHeifDecoder || fmt.needsCliDecoder) && tool.id === "image-enhancement"
? 300_000
: fmt.needsHeifDecoder || fmt.needsCliDecoder
? 180_000
: tool.id === "image-enhancement"
? 120_000
: undefined;
it(
`${tool.label}`,
+1 -1
View File
@@ -678,7 +678,7 @@ describe("Authentication", () => {
// ── HEIF input ─────────────────────────────────────────────────
describe("HEIF input", () => {
it("enhances HEIF (sample.heif) input", { timeout: 120_000 }, async () => {
it("enhances HEIF (sample.heif) input", { timeout: 300_000 }, async () => {
const HEIF = readFileSync(join(FIXTURES, "formats", "sample.heif"));
const res = await postTool({ mode: "auto" }, HEIF, "sample.heif", "image/heif");
expect([200, 422]).toContain(res.statusCode);