Skip to content

perf(registry): share reconciliation storage limit - #1558

Closed
ricardo-devis-agullo wants to merge 2 commits into
masterfrom
advisor/008-reconciliation-concurrency
Closed

perf(registry): share reconciliation storage limit#1558
ricardo-devis-agullo wants to merge 2 commits into
masterfrom
advisor/008-reconciliation-concurrency

Conversation

@ricardo-devis-agullo

Copy link
Copy Markdown
Collaborator

Plan 008: Enforce one storage concurrency budget during legacy reconciliation

  • Replace nested per-component pLimit queues (up to M² concurrent integrity reads) with a shared indexed worker-pool mapWithConcurrency
  • Two-phase schedule after root listSubDirectories: (1) per-component version listings (2) package-integrity getJson validations, both bounded by cdn.maxConcurrentRequests
  • mapWithConcurrency preallocates output, uses shared nextIndex, starts min(concurrency, n) worker loops, aggregates only worker promises, validates concurrency like pLimit, preserves order
  • No eager per-item promise/closure/queue creation; only O(concurrency) live promises per phase; no nested-await deadlock
  • Preserves semver sorting, corrupted_version events, dir_not_found handling and rejection propagation
  • Tests: utils-map-with-concurrency.js (10k deferred admission, order, rejection, worker-count) and registry-domain-components-cache.js global-concurrency fixtures (max 2, capacity 1/10, single-version invalid, dir-list rejection, empty registry, no leftover queued work)

Closes plan 008.

Enforce one storage concurrency budget during legacy reconciliation.
Replace nested per-component pLimit queues (M*M) with a shared
indexed worker-pool (mapWithConcurrency) run in two sequential phases
after the root listing, keeping only O(maxConcurrentRequests) live
operations, preserving output order, semver sorting and corruption
events.
Record first failure with explicit hasFirstError sentinel instead of
overwriting firstError and using err ?? firstError fallback. Ensures
concurrent rejections with null/undefined preserve the original reason
and match Promise.all/pLimit externally visible rejection type.
@ricardo-devis-agullo
ricardo-devis-agullo deleted the advisor/008-reconciliation-concurrency branch August 25, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant