Skip to content

Let concurrent publishes to one repository wait for their turn - #451

Open
aevnsvi wants to merge 1 commit into
pulp:mainfrom
AVSystem:fix-concurrent-publish
Open

aevnsvi wants to merge 1 commit into
pulp:mainfrom
AVSystem:fix-concurrent-publish

Conversation

@aevnsvi

@aevnsvi aevnsvi commented Oct 28, 2026

Copy link
Copy Markdown

Problem

The publish endpoint (PUT /<package>) adds each published package with a task dispatched
with immediate=True, deferred=False and the repository as an exclusive resource. When
another publish holds the repository at that moment, pulpcore cancels the task ("Resources
temporarily unavailable.") and the endpoint answers 429. npm, yarn and pnpm do not retry a
refused publish, so publishing several packages into one repository at the same time fails,
for example a workspace that publishes all its packages, or two pipelines that publish at
once.

Change

The task may now wait in the queue for a worker (deferred=True), and the request waits for
it for up to NPM_PUBLISH_TASK_TIMEOUT seconds (30 by default) before answering 429. This is
what the container registry API does for its uploads. A publish that finds the repository
free still runs immediately, as before.

  • New setting NPM_PUBLISH_TASK_TIMEOUT.
  • Docs: a short "Concurrent Publishes" section in the npm publish guide.
  • Changelog: CHANGES/+concurrent-publishes.bugfix.

Tests

test_concurrent_publishes_to_one_repository_all_succeed publishes 8 packages at once and
expects all 201 and all 8 packages in the latest version. Without the change it fails with
429s; with it, it passes repeatedly. The rest of the functional suite passes unchanged.

The Maven plugin has the same pattern in its deploy API; pulp/pulp_maven#562 carries the
equivalent change there.

Each published package is added by a task that holds the repository
exclusively. The task was dispatched as immediate only, so a publish arriving
while another one held the repository was canceled and answered with 429. npm
does not retry that, so publishing several packages at once, as workspace
tools do, failed.

The task may now wait in the queue for a worker, and the request waits for it
for up to NPM_PUBLISH_TASK_TIMEOUT seconds (30 by default) before answering
429, as the container registry API does for its uploads.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant