Production 2-core host: adaptive packet scans measured 21-163 s cold, the web side aborted at 8 s (BrokenPipe, 「排盘服务暂时没有响应」). The API's per-IP limiter saw only the web container, so every user shared 120 calls a minute (jyotish_api_429 on launch night). Frozen-file change limited to the limiter default, owner-approved for production blockers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
15 lines
849 B
TypeScript
15 lines
849 B
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
const source = readFileSync(new URL("../src/lib/chart-choice/server.ts", import.meta.url), "utf8");
|
|
|
|
test("BUG-2274: chart-choice engine calls wait long enough for an adaptive scan on a 2-core host", () => {
|
|
// 原值 8000 / 20_000;新值 180_000;原因:自适应扫描冷启动实测 21–163 s,8 s 时网页先断开。
|
|
const normal = Number(/const ENGINE_TIMEOUT_MS = ([\d_]+);/u.exec(source)?.[1]?.replaceAll("_", ""));
|
|
const wide = Number(/const RESTORE_WIDE_RANGE_TIMEOUT_MS = ([\d_]+);/u.exec(source)?.[1]?.replaceAll("_", ""));
|
|
assert.ok(normal >= 180_000, `normal timeout ${normal}`);
|
|
assert.ok(wide >= normal, `wide timeout ${wide}`);
|
|
assert.match(source, /signal: AbortSignal\.timeout\(timeoutMs\)/u);
|
|
});
|