Skip to content

Commit

Permalink
runSequentially(): expand docs on current usage (#1367)
Browse files Browse the repository at this point in the history
The "current use" documentation does not cover all current uses.

Alternatively, this documentation could be removed completely, and intention for calling runSequentially() could be defined at the call sites.
  • Loading branch information
alxndrsn authored Jan 15, 2025
1 parent 5af7c5a commit e68ba1e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/util/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ const runSequentially = async (functions) => {

for (const fn of functions) {
// reason: we want to run functions sequentially
// Current use: each function is dependent on DB transaction
// we can't do parallel processing with transaction
// Current uses:
// 1. prevent deadlock due to parallel queries starting sub-transactions
// See: #868 / worker.runJobs()
// 2. reduce number of parallel database connections compared Promise.all()
// See: #1344 / Analytics.previewMetrics()

// eslint-disable-next-line no-await-in-loop
results.push(await fn());
}
Expand Down

0 comments on commit e68ba1e

Please sign in to comment.