Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/1305.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disabling the chunk uploads to the synchronous rpm endpoint to improve performance.
19 changes: 11 additions & 8 deletions pulp-glue/src/pulp_glue/rpm/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,18 @@ def upload(
size = os.path.getsize(file.name)
body: dict[str, t.Any] = {**kwargs}

use_upload_endpoint = repository is None and self.pulp_ctx.has_plugin(
PluginRequirement("rpm", specifier=">=3.32.5")
)

if not self.pulp_ctx.fake_mode:
if chunk_size > size:
# Small file: direct upload
# The "upload" endpoint always requires direct file upload (no chunking)
# The "create" endpoint supports chunked upload for large files
if use_upload_endpoint or chunk_size > size:
# Direct file upload: required for upload endpoint, or small files
body["file"] = file
else:
# Large file: chunked upload
# Large file with create endpoint: chunked upload
if self.pulp_ctx.has_plugin(PluginRequirement("core", specifier=">=3.20.0")):
from pulp_glue.core.context import PulpUploadContext

Expand All @@ -195,11 +201,8 @@ def upload(
artifact_href = PulpArtifactContext(self.pulp_ctx).upload(file, chunk_size)
body["artifact"] = artifact_href

# For rpm plugin >= 3.32.5, use synchronous upload endpoint when no repository is provided
# For older versions, always use the create endpoint (backward compatibility)
if repository is None and self.pulp_ctx.has_plugin(
PluginRequirement("rpm", specifier=">=3.32.5")
):
# Call the appropriate endpoint
if use_upload_endpoint:
return self.call("upload", body=body)

# Repository is specified or older rpm version: use create endpoint (async path)
Expand Down
Loading