fix(runPool): don't report capped when pool is larger than workload (…#932
Open
hakanbaysal wants to merge 2 commits into
Open
fix(runPool): don't report capped when pool is larger than workload (…#932hakanbaysal wants to merge 2 commits into
hakanbaysal wants to merge 2 commits into
Conversation
…ksglu#915) `capped` was derived from `effectiveConcurrency`, which includes `jobs.length` in its `Math.min(...)`. When fewer jobs than the requested concurrency were passed (e.g. runPool([j1, j2], { concurrency: 8 })), `effectiveConcurrency` dropped to the job count and `capped` became `true` even though no CPU or explicit cap was applied. This surfaced in ctx_fetch_and_index as a misleading `cap=N/Mcpu` note implying the host CPU count throttled the batch, when the pool was simply larger than the workload. Derive `capped` from the CPU/explicit cap only (`Math.min(requested, cpuCap) < requested`), ignoring the job-count clamp. `effectiveConcurrency` is unchanged. Updates the doc comment and the runPool test that asserted the old behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…#915)
cappedwas derived fromeffectiveConcurrency, which includesjobs.lengthin itsMath.min(...). When fewer jobs than the requested concurrency were passed (e.g. runPool([j1, j2], { concurrency: 8 })),effectiveConcurrencydropped to the job count andcappedbecametrueeven though no CPU or explicit cap was applied.This surfaced in ctx_fetch_and_index as a misleading
cap=N/Mcpunote implying the host CPU count throttled the batch, when the pool was simply larger than the workload.Derive
cappedfrom the CPU/explicit cap only(
Math.min(requested, cpuCap) < requested), ignoring the job-count clamp.effectiveConcurrencyis unchanged. Updates the doc comment and the runPool test that asserted the old behavior.What / Why / How
Affected platforms
Test plan
Checklist
npm testpassesnpm run typecheckpassesnextbranch (unless hotfix)Cross-platform notes
Our CI runs on Ubuntu, macOS, and Windows.
path.join()/path.resolve(), never hardcode/separatorsreadFileSync(0)breaks on Windowsos.tmpdir(), never hardcode/tmp