Repository navigation
refactor: replace async.queue with a shared helper - #287
Merged
Merged
Conversation
Add forEachConcurrent and use it in collect-commit-labels and find-matching-prs, then remove the async dependency.
rvagg
reviewed
Nov 2, 2026
rvagg
reviewed
Nov 2, 2026
|
|
||
| q.push(sublist) | ||
| await q.drain() | ||
| return cache[key].then((val) => onFetch(null, val), (err) => onFetch(err)) |
Member
There was a problem hiding this comment.
as long as you're making it fully async, make the callback (onFetch) go away, this just needs a try/catch around await cache[key]:
try {
const issue = await cache[key]
if (issue.labels) {
commit.labels = issue.labels.map((label) => label.name)
}
} catch (err) {
console.error('Error fetching issue #%s: %s', commit.ghIssue, err.message)
}
Member
Author
There was a problem hiding this comment.
Done in 4d62b27
The worker is now async and awaits cache[key] in a try/catch, and onFetch is gone.
One small behavior change: an error while reading labels (e.g. issue resolving to undefined) is now logged and skipped like a fetch error. On main it's an unhandled rejection that crashes the process.
rvagg
approved these changes
Nov 2, 2026
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.
Replaces the two near-identical
async.queueblocks incollect-commit-labels.jsandfind-matching-prs.jswith a smallforEachConcurrenthelper, and removes theasyncdependency. The concurrency limit stays at 15.Also drops a broken
next()call infind-matching-prs.js.nextwas alwaysundefinedthere, and the queue swallowed the resulting error, so results weren't affected.