fix(process): use monotonic time for provider execution budgets

This commit is contained in:
morluto
2026-10-13 15:01:59 +08:00
parent b953f96c0a
commit d9e9fb2273
6 changed files with 47 additions and 12 deletions
@@ -33,7 +33,7 @@ it("rejects an exhausted shared execution budget before launching the next comma
arguments: ["--version"],
cwd: "/tmp/unused",
environment: {},
deadline: Date.now() - 1,
deadline: performance.now() - 1,
launcher: async () => {
throw new Error("An expired budget must not launch");
},
@@ -52,7 +52,7 @@ it("preserves caller cancellation before acquiring an expired execution budget",
arguments: ["--version"],
cwd: "/tmp/unused",
environment: {},
deadline: Date.now() - 1,
deadline: performance.now() - 1,
signal: AbortSignal.abort(),
launcher: async () => {
throw new Error("A cancelled request must not launch");
@@ -86,7 +86,7 @@ const commandFixture = (
arguments: ["--version"],
cwd: "/tmp/unused",
environment: {},
deadline: Date.now() + 5_000,
deadline: performance.now() + 5_000,
launcher,
},
};
@@ -140,7 +140,7 @@ it("enforces the shared deadline while exited output streams remain open", async
});
try {
await expect(
runWakaruCommand({ ...context, deadline: Date.now() + 50 }),
runWakaruCommand({ ...context, deadline: performance.now() + 50 }),
).rejects.toMatchObject({
_tag: "AnalysisTimeoutError",
operation: "recover_javascript_sources",