refactor: replace p-limit with inline concurrency limiter#1501
Open
roli-lpci wants to merge 2 commits intodanger:mainfrom
Open
refactor: replace p-limit with inline concurrency limiter#1501roli-lpci wants to merge 2 commits intodanger:mainfrom
roli-lpci wants to merge 2 commits intodanger:mainfrom
Conversation
Remove the `p-limit` (and `@types/p-limit`) dependency by inlining a lightweight concurrency limiter directly in GitHubAPI.ts. The inline implementation (~30 lines) provides the same semantics — a queue-based promise throttle capped at 25 concurrent requests — without pulling in an external ESM-only package.
Some callers mock `this.fetch` to return plain objects instead of Promises. The inline pLimit implementation called `fn().then()` directly which fails on non-thenable values. Wrapping with `Promise.resolve()` handles both cases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Replace the
p-limitdependency (and its@types/p-limitdev dependency) with a lightweight inline concurrency limiter (~30 lines) inGitHubAPI.ts.Motivation
p-limitv3+ is ESM-only, which creates friction in CJS codebases — the project currently pins^2.1.0to avoid thisp-limit+@types/p-limit) with zero behavior changeChanges
source/platforms/github/GitHubAPI.ts— Removep-limitimport, add inlinepLimit()function with identical queue-based semanticspackage.json— Removep-limitfromdependenciesand@types/p-limitfromdevDependenciesyarn.lock— Updated automaticallyTesting
tsc --noEmitpasses cleanlytsc -p tsconfig.production.json) compiles successfullymadgecheck passes)