mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
fix(test): preserve one-worker budgets under moderate load (#156258)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
parent
75fe4fec44
commit
da98b092e4
2 changed files with 16 additions and 2 deletions
|
|
@ -234,13 +234,13 @@ export function resolveLocalVitestScheduling(
|
|||
}
|
||||
|
||||
if (loadRatio >= 0.75) {
|
||||
const loadWorkers = Math.max(2, Math.ceil(inferred * 0.75));
|
||||
const loadWorkers = Math.ceil(inferred * 0.75);
|
||||
const maxWorkers =
|
||||
memoryPressureLimit === null ? loadWorkers : Math.min(loadWorkers, memoryPressureLimit);
|
||||
return {
|
||||
maxWorkers,
|
||||
fileParallelism: maxWorkers > 1,
|
||||
throttledBySystem: maxWorkers < inferred || maxWorkers < loadWorkers,
|
||||
throttledBySystem: maxWorkers < inferred || memoryPressureLimit === 1,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,20 @@ describe("vitest scheduling host snapshot", () => {
|
|||
|
||||
describe("local Vitest scheduling", () => {
|
||||
it.each([
|
||||
[
|
||||
"does not raise a single-core inferred budget under moderate load",
|
||||
{ cpuCount: 1, loadAverage1m: 0.75 },
|
||||
{},
|
||||
1,
|
||||
false,
|
||||
],
|
||||
[
|
||||
"does not raise a four-core inferred budget under moderate load",
|
||||
{ cpuCount: 4, totalMemoryBytes: 16 * 1024 ** 3, loadAverage1m: 3 },
|
||||
{},
|
||||
1,
|
||||
false,
|
||||
],
|
||||
[
|
||||
"caps total memory by the process constraint",
|
||||
{ constrainedMemoryBytes: 16 * 1024 ** 3 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue